{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "from geo import *\n",
    "key1_key = \"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 地理/逆地理编码"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 地理编码\n",
    "\n",
    "* 1、结构化地址的定义： 首先，地址肯定是一串字符，内含国家、省份、城市、区县、城镇、乡村、街道、门牌号码、屋邨、大厦等建筑物名称。按照由大区域名称到小区域名称组合在一起的字符。一个有效的地址应该是独一无二的。注意：针对大陆、港、澳地区的地理编码转换时可以将国家信息选择性的忽略，但省、市、城镇等级别的地址构成是不能忽略的。暂时不支持返回台湾省的详细地址信息。    \n",
    "* 2、url:https://restapi.amap.com/v3/geocode/geo?parameters      \n",
    "* 3、requests.get()       \n",
    "* 4、参数：   \n",
    "\n",
    "> * A.必选：key（高德API秘钥），address(结构化地址)  \n",
    "> * B.可选： 1. city-指定查询的城市（adcode信息可参考城市编码表获取）2. batch-批量查询控制 3. sig-数字签名 4. output-返回数据格式类型 5. callback-回调函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'该地点的地理编码为：113.763124,23.625183'"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"该地点的地理编码为：\" + geocode(key1_key,\"广东省广州市石门国家森林公园\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.679287,23.632575'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "geocode(key1_key,\"广东省广州市中山大学南方学院\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 逆地理编码\n",
    "- 逆地理编码：将经纬度转换为详细结构化的地址，且返回附近周边的POI、AOI信息。\n",
    "- url：https://restapi.amap.com/v3/geocode/regeo?parameters\n",
    "- requests.get() \n",
    "- 参数：\n",
    "> 1. 必选：key，location(经纬度坐标)\n",
    "> 2. 可选：poitype-返回附近POI类型 radius-搜索半径 extensions-返回结果控制 batch-批量查询控制 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广东省广州市从化区温泉镇中山大学南方学院'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regeocode(key1_key,\"113.679287,23.632575\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 路径规划"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 步行路径规划"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 接口简介：步行路径规划 API 可以规划100KM以内的步行通勤方案，并且返回通勤方案的数据。（使用经纬度调用）\n",
    "- URL：https://restapi.amap.com/v3/direction/walking?parameters\n",
    "- 请求方式：requests.get()  \n",
    "- * 4、参数：   \n",
    "\n",
    "> * A.必选：key，origin-出发点，destination-目的地\n",
    "> * B.可选：sig-数字签名，output-返回数据格式类型，callback-回调函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.679287,23.632575\n",
      "113.763124,23.625183\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[{'instruction': '向东步行101米右转',\n",
       "  'orientation': '东',\n",
       "  'road': [],\n",
       "  'distance': '101',\n",
       "  'duration': '81',\n",
       "  'polyline': '113.679592,23.632491;113.680586,23.632522',\n",
       "  'action': '右转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向南步行199米向右前方行走',\n",
       "  'orientation': '南',\n",
       "  'road': [],\n",
       "  'distance': '199',\n",
       "  'duration': '159',\n",
       "  'polyline': '113.680586,23.632522;113.680638,23.63214;113.680668,23.63174;113.680634,23.631541;113.68059,23.631437;113.68059,23.631437;113.680499,23.631241;113.680408,23.631094;113.680208,23.630842',\n",
       "  'action': '向右前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向西步行159米左转',\n",
       "  'orientation': '西',\n",
       "  'road': [],\n",
       "  'distance': '159',\n",
       "  'duration': '127',\n",
       "  'polyline': '113.680204,23.630838;113.680035,23.630773;113.680035,23.630773;113.679644,23.630638;113.679644,23.630638;113.679362,23.630521;113.679201,23.630473;113.679201,23.630473;113.679032,23.63043;113.679032,23.63043;113.67888,23.630404;113.67888,23.630404;113.678711,23.630365',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向南步行237米左转',\n",
       "  'orientation': '南',\n",
       "  'road': [],\n",
       "  'distance': '237',\n",
       "  'duration': '190',\n",
       "  'polyline': '113.678711,23.63036;113.678711,23.62934;113.678711,23.62934;113.678711,23.629193;113.678689,23.629084;113.678637,23.629023;113.678424,23.628902;113.678368,23.628841;113.678316,23.628724;113.678294,23.628611;113.678294,23.628611;113.678277,23.628372',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向东南步行177米左转',\n",
       "  'orientation': '东南',\n",
       "  'road': [],\n",
       "  'distance': '177',\n",
       "  'duration': '142',\n",
       "  'polyline': '113.678273,23.628368;113.678572,23.628338;113.678685,23.628307;113.678685,23.628307;113.678845,23.628234;113.679045,23.628073;113.679158,23.627964;113.679158,23.627964;113.679214,23.627869;113.679236,23.627778;113.67928,23.627526;113.679288,23.627322',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向东南步行1988米向左前方行走',\n",
       "  'orientation': '东南',\n",
       "  'road': [],\n",
       "  'distance': '1988',\n",
       "  'duration': '1590',\n",
       "  'polyline': '113.679288,23.627318;113.67997,23.627418;113.680082,23.627448;113.680165,23.627487;113.680165,23.627487;113.680256,23.627513;113.680317,23.627509;113.680503,23.627322;113.680655,23.62724;113.680738,23.627222;113.681029,23.627205;113.681189,23.627144;113.68148,23.627109;113.681576,23.627083;113.681671,23.627031;113.681814,23.626888;113.681944,23.626801;113.682148,23.626753;113.682357,23.62674;113.682357,23.62674;113.682661,23.626758;113.68296,23.626823;113.683186,23.626849;113.684058,23.626819;113.684666,23.626832;113.685039,23.626871;113.685408,23.626879;113.685799,23.626879;113.686354,23.626858;113.686354,23.626858;113.686523,23.626814;113.687222,23.626536;113.687665,23.626406;113.688338,23.626276;113.688611,23.626233;113.688789,23.626224;113.689106,23.626237;113.689223,23.626233;113.689453,23.626159;113.689618,23.626037;113.689696,23.625998;113.689796,23.625981;113.690082,23.625977;113.690313,23.625929;113.690313,23.625929;113.690864,23.625794;113.690964,23.625794;113.691098,23.625816;113.691228,23.625877;113.691319,23.625959;113.691389,23.626037;113.691458,23.626194;113.691549,23.626311;113.691632,23.626354;113.691823,23.626385;113.691901,23.626385;113.691975,23.626372;113.692183,23.626267;113.692587,23.626133;113.692747,23.626042;113.692747,23.626042;113.692891,23.625877;113.692947,23.625777;113.692947,23.625777;113.693142,23.625456;113.69316,23.625378;113.693142,23.625269;113.692986,23.625;113.692895,23.624826;113.692843,23.624661;113.692821,23.624557;113.692839,23.62418;113.692938,23.623368;113.692934,23.623247;113.692873,23.623151;113.6927,23.622951;113.692669,23.622882;113.692661,23.622799;113.692669,23.622639;113.692669,23.622561;113.692509,23.622062;113.69247,23.621992;113.692318,23.621793;113.692261,23.621697;113.692231,23.621628',\n",
       "  'action': '向左前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿平岗罗洞街向南步行296米',\n",
       "  'orientation': '南',\n",
       "  'road': '平岗罗洞街',\n",
       "  'distance': '296',\n",
       "  'duration': '237',\n",
       "  'polyline': '113.692227,23.621623;113.692227,23.621471;113.692227,23.621471;113.692253,23.62135;113.692587,23.620343;113.692617,23.620239;113.692617,23.620156;113.6926,23.620026;113.692418,23.61934;113.692409,23.619253;113.692418,23.619032',\n",
       "  'action': [],\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向南步行151米向右前方行走',\n",
       "  'orientation': '南',\n",
       "  'road': [],\n",
       "  'distance': '151',\n",
       "  'duration': '121',\n",
       "  'polyline': '113.692418,23.619028;113.692409,23.618932;113.692209,23.618533;113.692222,23.618342;113.692283,23.617912;113.692326,23.617708',\n",
       "  'action': '向右前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向南步行92米向右前方行走',\n",
       "  'orientation': '南',\n",
       "  'road': [],\n",
       "  'distance': '92',\n",
       "  'duration': '74',\n",
       "  'polyline': '113.692326,23.617704;113.692287,23.617287;113.692218,23.616879',\n",
       "  'action': '向右前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿平岗罗洞街向南步行199米左转',\n",
       "  'orientation': '南',\n",
       "  'road': '平岗罗洞街',\n",
       "  'distance': '199',\n",
       "  'duration': '159',\n",
       "  'polyline': '113.692214,23.616875;113.691905,23.616337;113.691714,23.616098;113.691667,23.615994;113.691502,23.615239',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '向东南步行293米左转',\n",
       "  'orientation': '东南',\n",
       "  'road': [],\n",
       "  'distance': '293',\n",
       "  'duration': '234',\n",
       "  'polyline': '113.691497,23.615234;113.691671,23.615256;113.691992,23.615334;113.692274,23.615352;113.692418,23.615404;113.692526,23.615421;113.6926,23.615404;113.692808,23.615247;113.692982,23.615169;113.69303,23.615169;113.693103,23.615187;113.693212,23.615095;113.693212,23.615095;113.693481,23.614813;113.693615,23.61464;113.693633,23.614592;113.693646,23.61444;113.69362,23.61431',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东北步行734米',\n",
       "  'orientation': '东北',\n",
       "  'road': '934县道',\n",
       "  'distance': '734',\n",
       "  'duration': '587',\n",
       "  'polyline': '113.693615,23.614306;113.694015,23.614332;113.694015,23.614332;113.69454,23.614375;113.69454,23.614375;113.695386,23.61444;113.695616,23.614475;113.695942,23.614553;113.697018,23.61487;113.697227,23.61497;113.697821,23.615404;113.698416,23.615816;113.698416,23.615816;113.698997,23.616285;113.700004,23.616931',\n",
       "  'action': [],\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东步行344米向右前方行走',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '344',\n",
       "  'duration': '275',\n",
       "  'polyline': '113.700004,23.616931;113.700139,23.617027;113.700299,23.61707;113.701736,23.617188;113.701949,23.617222;113.702083,23.61727;113.702083,23.61727;113.702214,23.617335;113.702214,23.617335;113.702995,23.617847;113.702995,23.617847;113.703108,23.617938',\n",
       "  'action': '向右前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东步行474米直行',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '474',\n",
       "  'duration': '379',\n",
       "  'polyline': '113.703108,23.617938;113.704549,23.618125;113.704549,23.618125;113.704948,23.618168;113.704948,23.618168;113.70503,23.618173;113.70503,23.618173;113.705291,23.618194;113.705291,23.618194;113.706441,23.618325;113.706441,23.618325;113.707296,23.618398;113.707296,23.618398;113.70776,23.618442',\n",
       "  'action': '直行',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿中田石井街向东步行640米直行',\n",
       "  'orientation': '东',\n",
       "  'road': '中田石井街',\n",
       "  'distance': '640',\n",
       "  'duration': '512',\n",
       "  'polyline': '113.70776,23.618442;113.708325,23.618507;113.709028,23.618559;113.70924,23.618585;113.70924,23.618585;113.709431,23.618641;113.711727,23.619397;113.711966,23.619501;113.711966,23.619501;113.712348,23.619679;113.712348,23.619679;113.712895,23.619926;113.712895,23.619926;113.713416,23.620174;113.713681,23.620273',\n",
       "  'action': '直行',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东步行157米直行',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '157',\n",
       "  'duration': '126',\n",
       "  'polyline': '113.713681,23.620273;113.714049,23.620395;113.714049,23.620395;113.714987,23.620681;113.714987,23.620681;113.715139,23.620755',\n",
       "  'action': '直行',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿桃田岗街向东步行2889米直行',\n",
       "  'orientation': '东',\n",
       "  'road': '桃田岗街',\n",
       "  'distance': '2889',\n",
       "  'duration': '2311',\n",
       "  'polyline': '113.715139,23.620755;113.715786,23.621107;113.716102,23.621259;113.716328,23.62135;113.718963,23.622031;113.718963,23.622031;113.720321,23.622378;113.720321,23.622378;113.720747,23.622478;113.720747,23.622478;113.720955,23.622509;113.721111,23.622509;113.721662,23.622452;113.722973,23.622174;113.722973,23.622174;113.725126,23.621723;113.725126,23.621723;113.726988,23.621328;113.726988,23.621328;113.72753,23.621207;113.72753,23.621207;113.727726,23.621163;113.727726,23.621163;113.728155,23.621085;113.728155,23.621085;113.728789,23.620955;113.728789,23.620955;113.729019,23.620911;113.729019,23.620911;113.729588,23.620786;113.730061,23.620707;113.730412,23.620681;113.730564,23.620677;113.731345,23.62072;113.731345,23.62072;113.731819,23.620768;113.732031,23.620803;113.732161,23.620838;113.732595,23.621007;113.733459,23.621376;113.733602,23.621419;113.733776,23.621445;113.734214,23.621489;113.734449,23.621493;113.734722,23.62148;113.737179,23.621263;113.737179,23.621263;113.737669,23.621228;113.737964,23.621224;113.738121,23.621237;113.738121,23.621237;113.738273,23.62128;113.738737,23.621441;113.738737,23.621441;113.739041,23.621541;113.739249,23.621584;113.739249,23.621584;113.740408,23.621801;113.741888,23.62201;113.742062,23.622018;113.742674,23.621979',\n",
       "  'action': '直行',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东步行1222米',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '1222',\n",
       "  'duration': '978',\n",
       "  'polyline': '113.742674,23.621975;113.743207,23.621949;113.743346,23.621957;113.743572,23.622005;113.744444,23.6223;113.744627,23.622322;113.744709,23.622313;113.744826,23.622261;113.745078,23.622079;113.745139,23.622014;113.745273,23.621749;113.745373,23.621623;113.745473,23.62158;113.745582,23.62158;113.745777,23.621658;113.746267,23.621957;113.74674,23.622292;113.74786,23.622695;113.74796,23.622747;113.748138,23.622882;113.748138,23.622882;113.748511,23.623194;113.748763,23.623429;113.748915,23.623559;113.749015,23.623611;113.749188,23.623646;113.749275,23.623646;113.749371,23.623615;113.749531,23.623524;113.749618,23.623429;113.749618,23.623429;113.750004,23.622826;113.750234,23.622496;113.750404,23.622283;113.750534,23.62204;113.750638,23.621927;113.750846,23.621832;113.751411,23.621628;113.751662,23.621554;113.751766,23.621497;113.752075,23.621254;113.752166,23.621194;113.752296,23.62115',\n",
       "  'action': [],\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东步行777米向右前方行走',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '777',\n",
       "  'duration': '622',\n",
       "  'polyline': '113.752296,23.621146;113.7524,23.621133;113.752582,23.621133;113.752582,23.621133;113.752752,23.621146;113.752865,23.621172;113.752943,23.621202;113.753125,23.621345;113.753898,23.62174;113.754002,23.621784;113.754123,23.621806;113.754223,23.621806;113.754605,23.621697;113.754735,23.621697;113.754818,23.621732;113.754913,23.621793;113.754987,23.621875;113.75523,23.622244;113.75523,23.622244;113.755321,23.622313;113.755447,23.622352;113.755699,23.622313;113.75579,23.622309;113.755864,23.622326;113.755933,23.622374;113.756063,23.622517;113.756133,23.622578;113.756263,23.62263;113.756354,23.622635;113.756437,23.622613;113.756458,23.622582;113.756476,23.622535;113.756463,23.622448;113.756328,23.622266;113.756302,23.622192;113.756306,23.622079;113.756367,23.622014;113.756424,23.621997;113.756536,23.622014;113.757183,23.622192;113.757244,23.622196;113.757361,23.622166;113.757635,23.622001;113.757734,23.621979;113.757804,23.622014;113.757826,23.622053;113.757873,23.622257;113.757908,23.622357;113.757956,23.6224;113.758016,23.622422',\n",
       "  'action': '向右前方行走',\n",
       "  'assistant_action': [],\n",
       "  'walk_type': '0'},\n",
       " {'instruction': '沿934县道向东北步行1872米到达目的地',\n",
       "  'orientation': '东北',\n",
       "  'road': '934县道',\n",
       "  'distance': '1872',\n",
       "  'duration': '1498',\n",
       "  'polyline': '113.758016,23.622422;113.758069,23.622418;113.758116,23.62237;113.758116,23.62237;113.75816,23.622292;113.75819,23.622174;113.75816,23.621793;113.75816,23.62171;113.758177,23.621649;113.758247,23.621558;113.758316,23.621506;113.758437,23.62145;113.758772,23.621363;113.758941,23.621341;113.759054,23.621302;113.759093,23.621263;113.759115,23.621207;113.759123,23.621155;113.759097,23.621024;113.759102,23.620977;113.759132,23.620911;113.759227,23.620812;113.759353,23.620734;113.759575,23.620608;113.759696,23.620595;113.75977,23.620625;113.7598,23.620664;113.7598,23.620729;113.759735,23.62092;113.759735,23.621016;113.759735,23.621016;113.759757,23.621185;113.759961,23.621892;113.759983,23.622326;113.760022,23.622357;113.760161,23.622413;113.760321,23.622439;113.76036,23.622478;113.760365,23.622517;113.760334,23.622617;113.760278,23.622678;113.760113,23.622834;113.760022,23.622934;113.759957,23.623034;113.759861,23.623342;113.759674,23.623802;113.75967,23.623941;113.759679,23.623997;113.759718,23.624102;113.759983,23.624592;113.760109,23.62487;113.760204,23.625035;113.760352,23.625213;113.761159,23.626042;113.76122,23.626085;113.761319,23.626081;113.761372,23.626029;113.761419,23.625916;113.761428,23.625807;113.76102,23.624839;113.761003,23.624748;113.761016,23.624679;113.761046,23.624631;113.76125,23.624436;113.761337,23.624384;113.761337,23.624384;113.76174,23.624136;113.761944,23.623989;113.762296,23.623633;113.762387,23.623572;113.76273,23.623472;113.76286,23.623407;113.76296,23.623338;113.763203,23.623095;113.763203,23.623095;113.763433,23.622743;113.763503,23.622661;113.763563,23.622622;113.763633,23.622587;113.763676,23.622587;113.763707,23.622609;113.763707,23.622609;113.763724,23.622635;113.763724,23.622682;113.76365,23.622839;113.76362,23.622947;113.763559,23.623451;113.763559,23.623451;113.76349,23.623715;113.76349,23.623715;113.763446,23.623898;113.763407,23.623971;113.763359,23.624041;113.763168,23.62421;113.763095,23.624332;113.763034,23.624544;113.763038,23.624648;113.763038,23.624648;113.763051,23.624744;113.763103,23.624839;113.763273,23.6251',\n",
       "  'action': [],\n",
       "  'assistant_action': '到达目的地',\n",
       "  'walk_type': '0'}]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "geocode_origin = geocode(key1_key,\"广东省广州市中山大学南方学院\")\n",
    "print(geocode_origin)\n",
    "geocode_destination = geocode(key1_key,\"广东省广州市石门国家森林公园\")\n",
    "print(geocode_destination)\n",
    "walk_data = walk_path(key1_key,geocode_origin,geocode_destination)\n",
    "walk_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0                向东步行101米右转\n",
       "1            向南步行199米向右前方行走\n",
       "2                向西步行159米左转\n",
       "3                向南步行237米左转\n",
       "4               向东南步行177米左转\n",
       "5          向东南步行1988米向左前方行走\n",
       "6            沿平岗罗洞街向南步行296米\n",
       "7            向南步行151米向右前方行走\n",
       "8             向南步行92米向右前方行走\n",
       "9          沿平岗罗洞街向南步行199米左转\n",
       "10              向东南步行293米左转\n",
       "11          沿934县道向东北步行734米\n",
       "12     沿934县道向东步行344米向右前方行走\n",
       "13         沿934县道向东步行474米直行\n",
       "14         沿中田石井街向东步行640米直行\n",
       "15         沿934县道向东步行157米直行\n",
       "16         沿桃田岗街向东步行2889米直行\n",
       "17          沿934县道向东步行1222米\n",
       "18     沿934县道向东步行777米向右前方行走\n",
       "19    沿934县道向东北步行1872米到达目的地\n",
       "Name: instruction, dtype: object"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(walk_data)['instruction']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 公交车路径规划\n",
    "- 接口简介：公交路径规划 API 可以规划综合各类公共（火车、公交、地铁）交通方式的通勤方案，并且返回通勤方案的数据。\n",
    "- URL：https://restapi.amap.com/v3/direction/transit/integrated?parameters\n",
    "- 请求方式：GET\n",
    "- 参数：\n",
    ">1. 必填：key,origin,destination（经纬度）,city/citycode\n",
    ">2. 选填：cityd-跨城公交规划时的终点城市，extensions-返回结果详略，strategy-公交换乘策略，nightflag-是否计算夜班车，date-出发日期，time-出发时间，sig-数字签名，output-返回数据格式类型，callback-回调函数\n",
    "详见：https://lbs.amap.com/api/webservice/guide/api/direction#bus"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '5',\n",
       " 'route': {'origin': '113.350961,23.131577',\n",
       "  'destination': '113.336127,23.113409',\n",
       "  'distance': '3224',\n",
       "  'taxi_cost': '14',\n",
       "  'transits': [{'cost': '1.0',\n",
       "    'duration': '3057',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '1408',\n",
       "    'distance': '4611',\n",
       "    'missed': '0',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.351013,23.131449',\n",
       "       'destination': '113.345055,23.125912',\n",
       "       'distance': '1225',\n",
       "       'duration': '1050',\n",
       "       'steps': [{'instruction': '沿明湖南路步行143米左转',\n",
       "         'road': '明湖南路',\n",
       "         'distance': '143',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351013,23.131449;113.351013,23.131449;113.350510,23.131393;113.350166,23.131359;113.349617,23.131298',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真茹路步行456米右转',\n",
       "         'road': '真茹路',\n",
       "         'distance': '456',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349617,23.131294;113.349609,23.131102;113.349594,23.130243;113.349594,23.129940;113.349602,23.129696;113.349617,23.128382;113.349609,23.128311;113.349617,23.128256;113.349602,23.127144',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿忠信路步行164米左转',\n",
       "         'road': '忠信路',\n",
       "         'distance': '164',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349602,23.127140;113.349144,23.127136;113.348541,23.127123;113.347977,23.127117',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行115米右转',\n",
       "         'road': [],\n",
       "         'distance': '115',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347977,23.127113;113.347954,23.126619;113.347946,23.126467;113.347878,23.126076',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿黄埔大道西步行67米向右前方行走',\n",
       "         'road': '黄埔大道西',\n",
       "         'distance': '67',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347870,23.126072;113.347603,23.126112;113.347534,23.126116;113.347221,23.126137',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行125米左转',\n",
       "         'road': [],\n",
       "         'distance': '125',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347214,23.126137;113.347214,23.126160;113.346947,23.126177;113.346901,23.125681;113.346588,23.125698;113.346596,23.125776',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿黄埔大道西步行155米到达国防大厦',\n",
       "         'road': '黄埔大道西',\n",
       "         'distance': '155',\n",
       "         'duration': [],\n",
       "         'polyline': '113.346596,23.125772;113.346306,23.125793;113.346100,23.125816;113.345978,23.125834;113.345726,23.125860;113.345055,23.125912',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达国防大厦'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '国防大厦',\n",
       "          'id': '900000105872002',\n",
       "          'location': '113.344963,23.125919'},\n",
       "         'arrival_stop': {'name': '猎德码头',\n",
       "          'id': '900000105872006',\n",
       "          'location': '113.337082,23.112673'},\n",
       "         'name': '669路(金穗路总站(马场路口)--金穗路总站(马场路口))',\n",
       "         'id': '900000105872',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '3203',\n",
       "         'duration': '1851',\n",
       "         'polyline': '113.344963,23.125919;113.344961,23.125920;113.345725,23.125859;113.345977,23.125833;113.346102,23.125816;113.346306,23.125794;113.347248,23.125738;113.347444,23.125768;113.347708,23.125738;113.348134,23.125673;113.348650,23.125595;113.348906,23.125408;113.349297,23.125321;113.349839,23.125200;113.349718,23.124605;113.349596,23.124162;113.349510,23.123837;113.349510,23.123832;113.349384,23.123368;113.348611,23.120503;113.348533,23.120226;113.348537,23.120230;113.348534,23.120235;113.348534,23.120232;113.348198,23.118980;113.348000,23.118338;113.347816,23.117743;113.347725,23.117605;113.347633,23.117527;113.347450,23.117386;113.347382,23.117395;113.347153,23.117418;113.346390,23.117496;113.346389,23.117496;113.346124,23.117522;113.344839,23.117609;113.344674,23.117622;113.344132,23.117648;113.343767,23.117661;113.343459,23.117682;113.343268,23.117422;113.343264,23.117179;113.343268,23.117010;113.343260,23.115990;113.343242,23.115239;113.343229,23.114661;113.343216,23.113763;113.343203,23.113307;113.343186,23.112313;113.343095,23.112092;113.342947,23.111953;113.342856,23.111918;113.342522,23.111962;113.342066,23.112031;113.341801,23.112070;113.341805,23.112072;113.341141,23.112171;113.340675,23.112226;113.338737,23.112469;113.338371,23.112513;113.337975,23.112560;113.337082,23.112673',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '5',\n",
       "         'via_stops': [{'name': '跑马地花园',\n",
       "           'id': '900000105872016',\n",
       "           'location': '113.349510,23.123837'},\n",
       "          {'name': '骏逸苑',\n",
       "           'id': '900000105872003',\n",
       "           'location': '113.348533,23.120226'},\n",
       "          {'name': '花城大道',\n",
       "           'id': '900000105872004',\n",
       "           'location': '113.346390,23.117496'},\n",
       "          {'name': '马场南路',\n",
       "           'id': '900000105872015',\n",
       "           'location': '113.343242,23.115239'},\n",
       "          {'name': '临江大道东',\n",
       "           'id': '900000105872005',\n",
       "           'location': '113.341801,23.112070'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.337013,23.112679',\n",
       "       'destination': '113.336212,23.113394',\n",
       "       'distance': '183',\n",
       "       'duration': '156',\n",
       "       'steps': [{'instruction': '沿临江大道步行62米右转',\n",
       "         'road': '临江大道',\n",
       "         'distance': '62',\n",
       "         'duration': [],\n",
       "         'polyline': '113.337013,23.112679;113.336601,23.112730;113.336403,23.112764',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海文路步行83米左转',\n",
       "         'road': '海文路',\n",
       "         'distance': '83',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336403,23.112764;113.336441,23.113173;113.336418,23.113516',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行17米左转',\n",
       "         'road': [],\n",
       "         'distance': '17',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336418,23.113516;113.336327,23.113554;113.336258,23.113581',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336258,23.113581;113.336212,23.113394',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': '2.0',\n",
       "    'duration': '2652',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '1875',\n",
       "    'distance': '3660',\n",
       "    'missed': '0',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.351013,23.131449',\n",
       "       'destination': '113.343330,23.123077',\n",
       "       'distance': '1692',\n",
       "       'duration': '1450',\n",
       "       'steps': [{'instruction': '沿明湖南路步行143米左转',\n",
       "         'road': '明湖南路',\n",
       "         'distance': '143',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351013,23.131449;113.351013,23.131449;113.350510,23.131393;113.350166,23.131359;113.349617,23.131298',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真茹路步行456米右转',\n",
       "         'road': '真茹路',\n",
       "         'distance': '456',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349617,23.131294;113.349609,23.131102;113.349594,23.130243;113.349594,23.129940;113.349602,23.129696;113.349617,23.128382;113.349609,23.128311;113.349617,23.128256;113.349602,23.127144',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿忠信路步行164米左转',\n",
       "         'road': '忠信路',\n",
       "         'distance': '164',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349602,23.127140;113.349144,23.127136;113.348541,23.127123;113.347977,23.127117',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行115米右转',\n",
       "         'road': [],\n",
       "         'distance': '115',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347977,23.127113;113.347954,23.126619;113.347946,23.126467;113.347878,23.126076',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿黄埔大道西步行448米左转',\n",
       "         'road': '黄埔大道西',\n",
       "         'distance': '448',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347870,23.126072;113.347603,23.126112;113.347534,23.126116;113.347221,23.126137;113.346855,23.126163;113.346703,23.126177;113.346245,23.126198;113.345619,23.126232;113.344688,23.126293;113.344040,23.126341;113.343880,23.126354;113.343674,23.126375;113.343460,23.126389',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿马场路步行366米到达红线女中心',\n",
       "         'road': '马场路',\n",
       "         'distance': '366',\n",
       "         'duration': [],\n",
       "         'polyline': '113.343460,23.126389;113.343376,23.126038;113.343376,23.125919;113.343361,23.125494;113.343353,23.125139;113.343346,23.124201;113.343346,23.123955;113.343346,23.123476;113.343330,23.123077',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达红线女中心'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '红线女中心',\n",
       "          'id': '440100016237010',\n",
       "          'location': '113.343323,23.123074'},\n",
       "         'arrival_stop': {'name': '猎德码头',\n",
       "          'id': '440100016237014',\n",
       "          'location': '113.337013,23.112682'},\n",
       "         'name': '138路(东莞庄总站--五羊新城总站)',\n",
       "         'id': '440100016237',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '1785',\n",
       "         'duration': '1045',\n",
       "         'polyline': '113.343323,23.123074;113.343323,23.122465;113.343323,23.122135;113.343323,23.121876;113.343323,23.121498;113.343346,23.121321;113.343346,23.120838;113.343315,23.119480;113.343315,23.119381;113.343300,23.118837;113.343300,23.118729;113.343300,23.118732;113.343300,23.118729;113.343300,23.118616;113.343300,23.118425;113.343292,23.117977;113.343277,23.117701;113.343269,23.117422;113.343269,23.117178;113.343269,23.117008;113.343262,23.115990;113.343246,23.115242;113.343246,23.115238;113.343224,23.114662;113.343216,23.113762;113.343201,23.113306;113.343193,23.112373;113.343117,23.112127;113.343063,23.112062;113.342949,23.111954;113.342865,23.111908;113.342339,23.111992;113.342064,23.112032;113.341805,23.112072;113.341141,23.112171;113.340675,23.112226;113.338737,23.112469;113.338371,23.112513;113.337975,23.112560;113.337013,23.112682',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '3',\n",
       "         'via_stops': [{'name': '马场路中',\n",
       "           'id': '440100016237011',\n",
       "           'location': '113.343300,23.118729'},\n",
       "          {'name': '马场路南',\n",
       "           'id': '440100016237022',\n",
       "           'location': '113.343246,23.115242'},\n",
       "          {'name': '临江大道东',\n",
       "           'id': '440100016237013',\n",
       "           'location': '113.341805,23.112072'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.337013,23.112679',\n",
       "       'destination': '113.336212,23.113394',\n",
       "       'distance': '183',\n",
       "       'duration': '156',\n",
       "       'steps': [{'instruction': '沿临江大道步行62米右转',\n",
       "         'road': '临江大道',\n",
       "         'distance': '62',\n",
       "         'duration': [],\n",
       "         'polyline': '113.337013,23.112679;113.336601,23.112730;113.336403,23.112764',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海文路步行83米左转',\n",
       "         'road': '海文路',\n",
       "         'distance': '83',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336403,23.112764;113.336441,23.113173;113.336418,23.113516',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行17米左转',\n",
       "         'road': [],\n",
       "         'distance': '17',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336418,23.113516;113.336327,23.113554;113.336258,23.113581',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336258,23.113581;113.336212,23.113394',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': '3.0',\n",
       "    'duration': '2915',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '2878',\n",
       "    'distance': '7016',\n",
       "    'missed': '0',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.351013,23.131449',\n",
       "       'destination': '113.339600,23.134882',\n",
       "       'distance': '1705',\n",
       "       'duration': '1461',\n",
       "       'steps': [{'instruction': '沿明湖南路步行35米左转',\n",
       "         'road': '明湖南路',\n",
       "         'distance': '35',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351013,23.131449;113.351357,23.131479',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真如东路步行219米向右前方行走',\n",
       "         'road': '真如东路',\n",
       "         'distance': '219',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351357,23.131479;113.351288,23.132196;113.351280,23.132383;113.351265,23.132973;113.351242,23.133142;113.351219,23.133255;113.351105,23.133425',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真如东路步行311米右转',\n",
       "         'road': '真如东路',\n",
       "         'distance': '311',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351105,23.133425;113.351105,23.133646;113.350967,23.134319;113.350739,23.135208;113.350723,23.135242;113.350685,23.135265;113.350037,23.135382;113.349899,23.135382;113.349792,23.135382;113.349709,23.135386',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行25米左转',\n",
       "         'road': [],\n",
       "         'distance': '25',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349709,23.135386;113.349724,23.135477;113.349762,23.135612',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿中山大道西辅路步行48米往前走',\n",
       "         'road': '中山大道西辅路',\n",
       "         'distance': '48',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349762,23.135612;113.349297,23.135685',\n",
       "         'action': '往前走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿中山大道西步行389米往前走',\n",
       "         'road': '中山大道西',\n",
       "         'distance': '389',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349289,23.135685;113.347931,23.135933;113.347603,23.135994;113.347290,23.136055;113.347237,23.136068;113.346786,23.136150;113.345551,23.136272',\n",
       "         'action': '往前走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿天河路辅路步行510米左转',\n",
       "         'road': '天河路辅路',\n",
       "         'distance': '510',\n",
       "         'duration': [],\n",
       "         'polyline': '113.345543,23.136272;113.345161,23.136219;113.344955,23.136181;113.344780,23.136147;113.343987,23.135981;113.343697,23.135916;113.343346,23.135841;113.342941,23.135756;113.342758,23.135715;113.342560,23.135668;113.342316,23.135612;113.342033,23.135538;113.341805,23.135481;113.341431,23.135395;113.340897,23.135260;113.340675,23.135187;113.340637,23.135170',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行168米到达岗顶',\n",
       "         'road': [],\n",
       "         'distance': '168',\n",
       "         'duration': [],\n",
       "         'polyline': '113.340630,23.135174;113.340607,23.134878;113.340248,23.134731;113.340080,23.135078;113.339600,23.134882',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达岗顶'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '岗顶',\n",
       "          'id': '440100023034005',\n",
       "          'location': '113.339601,23.134880'},\n",
       "         'arrival_stop': {'name': '珠江新城',\n",
       "          'id': '440100023034008',\n",
       "          'location': '113.321206,23.119293'},\n",
       "         'name': '地铁3号线(天河客运站--番禺广场)',\n",
       "         'id': '440100023034',\n",
       "         'type': '地铁线路',\n",
       "         'distance': '3158',\n",
       "         'duration': '316',\n",
       "         'polyline': '113.339601,23.134880;113.338709,23.134517;113.338282,23.134328;113.338056,23.134226;113.337864,23.134149;113.337673,23.134069;113.337473,23.134001;113.337212,23.133924;113.336968,23.133861;113.336742,23.133806;113.336464,23.133743;113.335455,23.133493;113.334924,23.133353;113.334733,23.133305;113.334585,23.133277;113.334305,23.133216;113.333834,23.133138;113.333091,23.133116;113.332124,23.133135;113.331184,23.133151;113.330589,23.133198;113.328752,23.133418;113.328183,23.133479;113.327289,23.133514;113.326354,23.133514;113.325081,23.133547;113.324429,23.133601;113.323537,23.133645;113.322613,23.133645;113.322308,23.133591;113.321994,23.133405;113.321558,23.132971;113.321548,23.132550;113.321503,23.131138;113.321456,23.129680;113.321411,23.128625;113.321320,23.127081;113.321280,23.124987;113.321239,23.122875;113.321210,23.120814;113.321206,23.119293',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': '0610',\n",
       "         'end_time': '2330',\n",
       "         'via_num': '2',\n",
       "         'via_stops': [{'name': '石牌桥',\n",
       "           'id': '440100023034006',\n",
       "           'location': '113.332124,23.133135'},\n",
       "          {'name': '体育西路',\n",
       "           'id': '440100023034007',\n",
       "           'location': '113.321503,23.131138'}]}]},\n",
       "      'entrance': {'name': 'D口', 'location': '113.340599,23.134874'},\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': [],\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '珠江新城',\n",
       "          'id': '440100023037014',\n",
       "          'location': '113.321206,23.119293'},\n",
       "         'arrival_stop': {'name': '猎德',\n",
       "          'id': '440100023037015',\n",
       "          'location': '113.332105,23.118539'},\n",
       "         'name': '地铁5号线(滘口--文冲)',\n",
       "         'id': '440100023037',\n",
       "         'type': '地铁线路',\n",
       "         'distance': '980',\n",
       "         'duration': '133',\n",
       "         'polyline': '113.321206,23.119293;113.322586,23.119290;113.324445,23.119121;113.326668,23.118952;113.329169,23.118750;113.331498,23.118582;113.332105,23.118539',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': '0615',\n",
       "         'end_time': '2315',\n",
       "         'via_num': '0',\n",
       "         'via_stops': []}]},\n",
       "      'entrance': [],\n",
       "      'exit': {'name': 'B口', 'location': '113.332726,23.118099'},\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.332100,23.118532',\n",
       "       'destination': '113.336212,23.113394',\n",
       "       'distance': '1172',\n",
       "       'duration': '1004',\n",
       "       'steps': [{'instruction': '步行151米右转',\n",
       "         'road': [],\n",
       "         'distance': '151',\n",
       "         'duration': [],\n",
       "         'polyline': '113.332100,23.118532;113.332779,23.118494;113.332809,23.118494;113.332779,23.118095;113.332726,23.118099;113.332695,23.118359',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿花城大道步行22米向右前方行走',\n",
       "         'road': '花城大道',\n",
       "         'distance': '22',\n",
       "         'duration': [],\n",
       "         'polyline': '113.332687,23.118359;113.332909,23.118347',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿猎德大道步行79米向右前方行走',\n",
       "         'road': '猎德大道',\n",
       "         'distance': '79',\n",
       "         'duration': [],\n",
       "         'polyline': '113.332909,23.118341;113.333267,23.118065;113.333488,23.117851',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿猎德大道步行298米右转',\n",
       "         'road': '猎德大道',\n",
       "         'distance': '298',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333488,23.117847;113.333519,23.117331;113.333519,23.117266;113.333534,23.116875;113.333542,23.116472;113.333549,23.116064;113.333557,23.115938;113.333580,23.115339;113.333588,23.115129',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行25米向右前方行走',\n",
       "         'road': [],\n",
       "         'distance': '25',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333580,23.115126;113.333488,23.115126;113.333488,23.115269',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行81米右转',\n",
       "         'road': [],\n",
       "         'distance': '81',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333488,23.115269;113.334015,23.115820',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行32米往前走',\n",
       "         'road': [],\n",
       "         'distance': '32',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334015,23.115820;113.334076,23.115639;113.334122,23.115561',\n",
       "         'action': '往前走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行10米右转',\n",
       "         'road': [],\n",
       "         'distance': '10',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334122,23.115555;113.334198,23.115490',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行10米右转',\n",
       "         'road': [],\n",
       "         'distance': '10',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334198,23.115486;113.334282,23.115435',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行109米左转',\n",
       "         'road': [],\n",
       "         'distance': '109',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334282,23.115429;113.334244,23.115152;113.334145,23.114449',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海月路步行230米右转',\n",
       "         'road': '海月路',\n",
       "         'distance': '230',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334137,23.114445;113.334671,23.114445;113.335442,23.114445;113.335617,23.114435;113.336395,23.114305',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海文路步行87米右转',\n",
       "         'road': '海文路',\n",
       "         'distance': '87',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336395,23.114302;113.336395,23.114050;113.336418,23.113520',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行17米左转',\n",
       "         'road': [],\n",
       "         'distance': '17',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336418,23.113516;113.336327,23.113554;113.336258,23.113581',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336258,23.113581;113.336212,23.113394',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': '2.0',\n",
       "    'duration': '3001',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '2143',\n",
       "    'distance': '4705',\n",
       "    'missed': '0',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.351013,23.131449',\n",
       "       'destination': '113.345055,23.125912',\n",
       "       'distance': '1225',\n",
       "       'duration': '1050',\n",
       "       'steps': [{'instruction': '沿明湖南路步行143米左转',\n",
       "         'road': '明湖南路',\n",
       "         'distance': '143',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351013,23.131449;113.351013,23.131449;113.350510,23.131393;113.350166,23.131359;113.349617,23.131298',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真茹路步行456米右转',\n",
       "         'road': '真茹路',\n",
       "         'distance': '456',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349617,23.131294;113.349609,23.131102;113.349594,23.130243;113.349594,23.129940;113.349602,23.129696;113.349617,23.128382;113.349609,23.128311;113.349617,23.128256;113.349602,23.127144',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿忠信路步行164米左转',\n",
       "         'road': '忠信路',\n",
       "         'distance': '164',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349602,23.127140;113.349144,23.127136;113.348541,23.127123;113.347977,23.127117',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行115米右转',\n",
       "         'road': [],\n",
       "         'distance': '115',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347977,23.127113;113.347954,23.126619;113.347946,23.126467;113.347878,23.126076',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿黄埔大道西步行67米向右前方行走',\n",
       "         'road': '黄埔大道西',\n",
       "         'distance': '67',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347870,23.126072;113.347603,23.126112;113.347534,23.126116;113.347221,23.126137',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行125米左转',\n",
       "         'road': [],\n",
       "         'distance': '125',\n",
       "         'duration': [],\n",
       "         'polyline': '113.347214,23.126137;113.347214,23.126160;113.346947,23.126177;113.346901,23.125681;113.346588,23.125698;113.346596,23.125776',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿黄埔大道西步行155米到达国防大厦',\n",
       "         'road': '黄埔大道西',\n",
       "         'distance': '155',\n",
       "         'duration': [],\n",
       "         'polyline': '113.346596,23.125772;113.346306,23.125793;113.346100,23.125816;113.345978,23.125834;113.345726,23.125860;113.345055,23.125912',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达国防大厦'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '国防大厦',\n",
       "          'id': '440100016838024',\n",
       "          'location': '113.344961,23.125920'},\n",
       "         'arrival_stop': {'name': '珠江新城总站',\n",
       "          'id': '440100016838027',\n",
       "          'location': '113.341133,23.116398'},\n",
       "         'name': '545路(泽德花苑总站--珠江新城总站)',\n",
       "         'id': '440100016838',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '2562',\n",
       "         'duration': '1165',\n",
       "         'polyline': '113.344961,23.125920;113.344963,23.125919;113.344961,23.125920;113.345725,23.125859;113.345977,23.125833;113.346102,23.125816;113.346306,23.125794;113.347248,23.125738;113.347444,23.125768;113.347708,23.125738;113.348134,23.125673;113.348650,23.125595;113.348906,23.125408;113.349297,23.125321;113.349839,23.125200;113.349718,23.124605;113.349596,23.124162;113.349505,23.123824;113.349505,23.123819;113.349384,23.123368;113.348611,23.120503;113.348533,23.120226;113.348533,23.120221;113.348194,23.118980;113.347999,23.118338;113.347808,23.117704;113.347708,23.117609;113.347517,23.117474;113.347374,23.117396;113.347096,23.117426;113.346862,23.117444;113.346450,23.117487;113.345981,23.117535;113.344839,23.117609;113.344674,23.117622;113.344132,23.117648;113.343767,23.117661;113.343459,23.117682;113.343268,23.117422;113.343264,23.117179;113.343268,23.117010;113.343260,23.115990;113.343242,23.115234;113.343229,23.114661;113.342196,23.114753;113.341319,23.114835;113.340911,23.114887;113.340890,23.115234;113.340859,23.115968;113.341194,23.115985;113.341150,23.116359;113.341133,23.116398',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': '0600',\n",
       "         'end_time': '2230',\n",
       "         'via_num': '3',\n",
       "         'via_stops': [{'name': '跑马地花园',\n",
       "           'id': '440100016838044',\n",
       "           'location': '113.349505,23.123824'},\n",
       "          {'name': '骏逸苑',\n",
       "           'id': '440100016838025',\n",
       "           'location': '113.348533,23.120226'},\n",
       "          {'name': '花城大道',\n",
       "           'id': '440100016838040',\n",
       "           'location': '113.346450,23.117487'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.341148,23.116323',\n",
       "       'destination': '113.336212,23.113394',\n",
       "       'distance': '918',\n",
       "       'duration': '786',\n",
       "       'steps': [{'instruction': '步行37米右转',\n",
       "         'road': [],\n",
       "         'distance': '37',\n",
       "         'duration': [],\n",
       "         'polyline': '113.341148,23.116323;113.341194,23.115990',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海明路步行500米左转',\n",
       "         'road': '海明路',\n",
       "         'distance': '500',\n",
       "         'duration': [],\n",
       "         'polyline': '113.341194,23.115986;113.340858,23.115973;113.340790,23.115973;113.340416,23.115976;113.339798,23.116058;113.339691,23.116076;113.338829,23.116177;113.338509,23.116220;113.338432,23.116228;113.337990,23.116316;113.337425,23.116442;113.337013,23.116524;113.336449,23.116632;113.336304,23.116632',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海文路步行343米右转',\n",
       "         'road': '海文路',\n",
       "         'distance': '343',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336304,23.116632;113.336327,23.116116;113.336365,23.115595;113.336365,23.115282;113.336372,23.114679;113.336395,23.114305;113.336395,23.114050;113.336418,23.113520',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行17米左转',\n",
       "         'road': [],\n",
       "         'distance': '17',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336418,23.113516;113.336327,23.113554;113.336258,23.113581',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336258,23.113581;113.336212,23.113394',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': '2.0',\n",
       "    'duration': '3372',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '2056',\n",
       "    'distance': '5880',\n",
       "    'missed': '0',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.351013,23.131449',\n",
       "       'destination': '113.351860,23.125507',\n",
       "       'distance': '1045',\n",
       "       'duration': '895',\n",
       "       'steps': [{'instruction': '沿明湖南路步行143米左转',\n",
       "         'road': '明湖南路',\n",
       "         'distance': '143',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351013,23.131449;113.351013,23.131449;113.350510,23.131393;113.350166,23.131359;113.349617,23.131298',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真茹路步行456米往前走',\n",
       "         'road': '真茹路',\n",
       "         'distance': '456',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349617,23.131294;113.349609,23.131102;113.349594,23.130243;113.349594,23.129940;113.349602,23.129696;113.349617,23.128382;113.349609,23.128311;113.349617,23.128256;113.349602,23.127144',\n",
       "         'action': '往前走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真如路步行132米左转',\n",
       "         'road': '真如路',\n",
       "         'distance': '132',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349602,23.127140;113.349609,23.127052;113.349617,23.127005;113.349625,23.126862;113.349655,23.126518;113.349678,23.126249;113.349693,23.126106;113.349693,23.126059;113.349709,23.125929',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿真如东路步行165米右转',\n",
       "         'road': '真如东路',\n",
       "         'distance': '165',\n",
       "         'duration': [],\n",
       "         'polyline': '113.349709,23.125925;113.350487,23.125790;113.350983,23.125769;113.351112,23.125803;113.351181,23.125841;113.351288,23.125908',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行69米往前走',\n",
       "         'road': [],\n",
       "         'distance': '69',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351288,23.125902;113.351341,23.125820;113.351486,23.125967;113.351601,23.125769;113.351715,23.125793',\n",
       "         'action': '往前走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行59米右转',\n",
       "         'road': [],\n",
       "         'distance': '59',\n",
       "         'duration': [],\n",
       "         'polyline': '113.351715,23.125793;113.351852,23.125813;113.351936,23.125799;113.351967,23.125772;113.352028,23.125729;113.352043,23.125687;113.352066,23.125517',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米到达华侨医院(潭村)',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.352066,23.125513;113.351860,23.125507',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达华侨医院(潭村)'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '华侨医院(潭村)',\n",
       "          'id': '440100016909035',\n",
       "          'location': '113.351713,23.125436'},\n",
       "         'arrival_stop': {'name': '猎德东',\n",
       "          'id': '440100016909014',\n",
       "          'location': '113.331558,23.118460'},\n",
       "         'name': '583路(员村一横路总站--芳村西塱总站)',\n",
       "         'id': '440100016909',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '3824',\n",
       "         'duration': '1610',\n",
       "         'polyline': '113.351713,23.125436;113.351562,23.125319;113.351051,23.125387;113.350380,23.125525;113.348694,23.125820;113.348137,23.125938;113.347801,23.125998;113.347450,23.126015;113.347298,23.126011;113.346436,23.126080;113.346230,23.126215;113.346016,23.126221;113.345619,23.126234;113.344696,23.126293;113.344032,23.126343;113.343956,23.126347;113.343887,23.126354;113.343674,23.126375;113.343460,23.126389;113.343292,23.126406;113.343117,23.126415;113.342972,23.126425;113.342819,23.126431;113.342323,23.126467;113.341743,23.126507;113.341522,23.126520;113.340981,23.126549;113.340614,23.126549;113.340424,23.126524;113.339592,23.126585;113.339470,23.126593;113.338676,23.126657;113.338058,23.126684;113.337997,23.126694;113.337830,23.126694;113.337746,23.126766;113.337410,23.126793;113.336723,23.126844;113.336571,23.126858;113.335106,23.126966;113.334961,23.126976;113.334282,23.127014;113.334152,23.127022;113.333939,23.127035;113.333717,23.127045;113.333557,23.127001;113.333443,23.126953;113.333244,23.126808;113.333176,23.126722;113.333168,23.126398;113.333168,23.126221;113.333191,23.125843;113.333229,23.125433;113.333244,23.124969;113.333275,23.124340;113.333397,23.124149;113.333397,23.123671;113.333344,23.123537;113.333336,23.123329;113.333336,23.123274;113.333298,23.123116;113.333244,23.123043;113.333122,23.122978;113.332886,23.122965;113.331841,23.123043;113.330780,23.123129;113.330536,23.123152;113.330421,23.123159;113.330193,23.123125;113.329697,23.123165;113.329376,23.123196;113.328613,23.123251;113.328178,23.123363;113.327850,23.123091;113.327904,23.122473;113.327904,23.122177;113.327904,23.121723;113.327858,23.121151;113.327858,23.120970;113.327843,23.119867;113.327843,23.119427;113.327843,23.119328;113.327715,23.119145;113.327628,23.119062;113.327576,23.118971;113.327492,23.119040;113.326553,23.119089;113.326347,23.119112;113.326137,23.119121;113.326094,23.119103;113.326042,23.119041;113.326050,23.118849;113.326416,23.118816;113.326782,23.118784;113.327469,23.118725;113.327827,23.118752;113.328087,23.118729;113.328453,23.118706;113.329308,23.118647;113.329674,23.118616;113.330666,23.118538;113.330734,23.118534;113.331558,23.118460',\n",
       "         'bustimetag': '0',\n",
       "         'start_time': '0630',\n",
       "         'end_time': '2200',\n",
       "         'via_num': '6',\n",
       "         'via_stops': [{'name': '国防大厦',\n",
       "           'id': '440100016909008',\n",
       "           'location': '113.341743,23.126507'},\n",
       "          {'name': '石牌村',\n",
       "           'id': '440100016909009',\n",
       "           'location': '113.339592,23.126585'},\n",
       "          {'name': '猎德大道北',\n",
       "           'id': '440100016909042',\n",
       "           'location': '113.333336,23.123329'},\n",
       "          {'name': '金穗路',\n",
       "           'id': '440100016909011',\n",
       "           'location': '113.329697,23.123165'},\n",
       "          {'name': '冼村路中',\n",
       "           'id': '440100016909012',\n",
       "           'location': '113.327843,23.119867'},\n",
       "          {'name': '猎德',\n",
       "           'id': '440100016909013',\n",
       "           'location': '113.329674,23.118616'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.331665,23.118454',\n",
       "       'destination': '113.336212,23.113394',\n",
       "       'distance': '1011',\n",
       "       'duration': '866',\n",
       "       'steps': [{'instruction': '沿花城大道步行246米向右前方行走',\n",
       "         'road': '花城大道',\n",
       "         'distance': '246',\n",
       "         'duration': [],\n",
       "         'polyline': '113.331665,23.118454;113.331879,23.118437;113.332687,23.118364;113.332909,23.118347;113.333267,23.118065;113.333267,23.118065;113.333473,23.118280;113.333885,23.118259',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行31米右转',\n",
       "         'road': [],\n",
       "         'distance': '31',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333885,23.118256;113.334099,23.118055',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿花城大道步行29米向左前方行走',\n",
       "         'road': '花城大道',\n",
       "         'distance': '29',\n",
       "         'duration': [],\n",
       "         'polyline': '113.334099,23.118052;113.334068,23.118025;113.333900,23.117851',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿猎德大道步行375米左转',\n",
       "         'road': '猎德大道',\n",
       "         'distance': '375',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333900,23.117847;113.333916,23.117365;113.333931,23.116741;113.333939,23.116358;113.333969,23.115152;113.333969,23.114449',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿海月路步行167米右转',\n",
       "         'road': '海月路',\n",
       "         'distance': '167',\n",
       "         'duration': [],\n",
       "         'polyline': '113.333969,23.114445;113.334137,23.114445;113.334671,23.114445;113.335442,23.114445;113.335617,23.114435',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行64米向左前方行走',\n",
       "         'road': [],\n",
       "         'distance': '64',\n",
       "         'duration': [],\n",
       "         'polyline': '113.335617,23.114431;113.335609,23.114105;113.335571,23.113850',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行78米右转',\n",
       "         'road': [],\n",
       "         'distance': '78',\n",
       "         'duration': [],\n",
       "         'polyline': '113.335571,23.113846;113.335602,23.113794;113.335678,23.113750;113.336151,23.113628;113.336258,23.113585',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行21米',\n",
       "         'road': [],\n",
       "         'distance': '21',\n",
       "         'duration': [],\n",
       "         'polyline': '113.336258,23.113581;113.336212,23.113394',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]}]}}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "origin = \"广东省广州市暨南大学\"\n",
    "bus_origin = geocode(key1_key,origin)\n",
    "# print(bus_orgin)\n",
    "destination = \"广东省广州市猎德\"\n",
    "bus_destination = geocode(key1_key,destination)\n",
    "# print(bus_destination)\n",
    "city = \"广州\" \n",
    "results_bus =  bus_path(key1_key,bus_origin,bus_destination,city)\n",
    "results_bus"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>站点名字</th>\n",
       "      <th>公交类型</th>\n",
       "      <th>公交行驶距离(米)</th>\n",
       "      <th>公交预计行驶时间(秒)</th>\n",
       "      <th>启程站</th>\n",
       "      <th>抵达站</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>669路(金穗路总站(马场路口)--金穗路总站(马场路口))</td>\n",
       "      <td>普通公交线路</td>\n",
       "      <td>3203</td>\n",
       "      <td>1851</td>\n",
       "      <td>国防大厦</td>\n",
       "      <td>猎德码头</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             站点名字    公交类型 公交行驶距离(米) 公交预计行驶时间(秒)   启程站   抵达站\n",
       "0  669路(金穗路总站(马场路口)--金穗路总站(马场路口))  普通公交线路      3203        1851  国防大厦  猎德码头"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.json_normalize(results_bus['route']['transits'][0]['segments'][0]['bus']['buslines'])[['name',\"type\",\"distance\",\"duration\",\"departure_stop.name\",\"arrival_stop.name\"]]\n",
    "df_bus = df.rename(columns={\"name\":\"站点名字\",\\\n",
    "                           \"type\":\"公交类型\",\n",
    "                           \"distance\":\"公交行驶距离(米)\",\n",
    "                           \"duration\":\"公交预计行驶时间(秒)\",\n",
    "                           \"departure_stop.name\":\"启程站\",\n",
    "                           \"arrival_stop.name\":\"抵达站\"   \n",
    "})\n",
    "df_bus"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 驾车路径规划\n",
    "- 接口简介：驾车路径规划 API 可以规划以小客车、轿车通勤出行的方案，并且返回通勤方案的数据。\n",
    "- URL：https://restapi.amap.com/v3/direction/driving?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,origin,destination（经纬度）,city/citycode\n",
    ">2. 选填：https://lbs.amap.com/api/webservice/guide/api/direction#driving\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "origin = \"广东省广州市中山大学南方学院\"\n",
    "car_origin = geocode(key1_key,origin)\n",
    "# geocode(key1_key,origin)\n",
    "# print(car_origin)\n",
    "\n",
    "destination = \"广东省广州市石门国家森林公园\"\n",
    "car_destination = geocode(key1_key,destination)\n",
    "# print(car_destination)\n",
    "# print(\"....\",car_destination)\n",
    "\n",
    "carcar = car_path(key1_key,car_origin,car_destination)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'instruction': '向南行驶9米左转',\n",
       "  'orientation': '南',\n",
       "  'distance': '9',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '8',\n",
       "  'polyline': '113.679596,23.632574;113.679596,23.632491',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '9',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.679596,23.632574;113.679596,23.632491'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向东行驶100米右转',\n",
       "  'orientation': '东',\n",
       "  'distance': '100',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '28',\n",
       "  'polyline': '113.679596,23.632491;113.680582,23.632522',\n",
       "  'action': '右转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '100',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.679596,23.632491;113.680582,23.632522'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向南行驶199米向右前方行驶',\n",
       "  'orientation': '南',\n",
       "  'distance': '199',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '47',\n",
       "  'polyline': '113.680582,23.632522;113.680642,23.632135;113.680668,23.631736;113.680642,23.631589;113.680629,23.631536;113.68059,23.631432;113.680499,23.631237;113.680399,23.631089;113.680204,23.630838',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '122',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.680582,23.632522;113.680642,23.632135;113.680668,23.631736;113.680642,23.631589;113.680629,23.631536;113.68059,23.631432'},\n",
       "   {'lcode': [],\n",
       "    'distance': '77',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.68059,23.631432;113.680499,23.631237;113.680399,23.631089;113.680204,23.630838'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向西行驶159米左转',\n",
       "  'orientation': '西',\n",
       "  'distance': '159',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '36',\n",
       "  'polyline': '113.680204,23.630838;113.68003,23.630768;113.67964,23.630634;113.679358,23.630516;113.679197,23.630469;113.678711,23.63036',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '18',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.680204,23.630838;113.68003,23.630768'},\n",
       "   {'lcode': [],\n",
       "    'distance': '42',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.68003,23.630768;113.67964,23.630634'},\n",
       "   {'lcode': [],\n",
       "    'distance': '48',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.67964,23.630634;113.679358,23.630516;113.679197,23.630469'},\n",
       "   {'lcode': [],\n",
       "    'distance': '51',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.679197,23.630469;113.678711,23.63036'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向南行驶237米左转',\n",
       "  'orientation': '南',\n",
       "  'distance': '237',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '65',\n",
       "  'polyline': '113.678711,23.63036;113.678711,23.629336;113.678698,23.629128;113.678663,23.629054;113.678572,23.628984;113.67842,23.628898;113.678364,23.628837;113.678325,23.628772;113.678299,23.628646;113.678273,23.628372',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '113',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678711,23.63036;113.678711,23.629336'},\n",
       "   {'lcode': [],\n",
       "    'distance': '124',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678711,23.629336;113.678698,23.629128;113.678663,23.629054;113.678572,23.628984;113.67842,23.628898;113.678364,23.628837;113.678325,23.628772;113.678299,23.628646;113.678273,23.628372'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向东南行驶105米向右前方行驶',\n",
       "  'orientation': '东南',\n",
       "  'distance': '105',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '51',\n",
       "  'polyline': '113.678273,23.628372;113.678572,23.628333;113.678689,23.628303;113.678845,23.628234;113.679045,23.628069;113.679162,23.62796',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '43',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678273,23.628372;113.678572,23.628333;113.678689,23.628303'},\n",
       "   {'lcode': [],\n",
       "    'distance': '62',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678689,23.628303;113.678845,23.628234;113.679045,23.628069;113.679162,23.62796'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向南行驶393米向右前方行驶',\n",
       "  'orientation': '南',\n",
       "  'distance': '393',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '66',\n",
       "  'polyline': '113.679162,23.62796;113.679214,23.627865;113.679236,23.627773;113.67928,23.627522;113.679288,23.627318;113.679249,23.626849;113.679184,23.626619;113.679136,23.626493;113.679002,23.62625;113.678937,23.626172;113.678707,23.625972;113.678615,23.625859;113.678529,23.625716;113.678507,23.625634;113.678433,23.625187;113.678424,23.625052;113.678455,23.624931;113.678572,23.624653',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '72',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.679162,23.62796;113.679214,23.627865;113.679236,23.627773;113.67928,23.627522;113.679288,23.627318'},\n",
       "   {'lcode': [],\n",
       "    'distance': '321',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.679288,23.627318;113.679249,23.626849;113.679184,23.626619;113.679136,23.626493;113.679002,23.62625;113.678937,23.626172;113.678707,23.625972;113.678615,23.625859;113.678529,23.625716;113.678507,23.625634;113.678433,23.625187;113.678424,23.625052;113.678455,23.624931;113.678572,23.624653'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '向西南行驶722米左转',\n",
       "  'orientation': '西南',\n",
       "  'distance': '722',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '98',\n",
       "  'polyline': '113.678572,23.624653;113.678555,23.624505;113.678411,23.624323;113.677578,23.623789;113.676528,23.623346;113.676354,23.623247;113.676263,23.623147;113.676102,23.62283;113.676037,23.622734;113.675786,23.622474;113.675499,23.62227;113.675412,23.62217;113.675378,23.622083;113.675373,23.621832;113.675391,23.621606;113.675438,23.621471;113.675538,23.621354;113.675764,23.621176;113.675851,23.621085;113.675898,23.62099;113.675911,23.620851;113.675868,23.62072;113.675786,23.620603;113.675742,23.620543;113.675595,23.620369;113.675239,23.620009',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '42',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.678572,23.624653;113.678555,23.624505;113.678411,23.624323'},\n",
       "   {'lcode': [],\n",
       "    'distance': '435',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.678411,23.624323;113.677578,23.623789;113.676528,23.623346;113.676354,23.623247;113.676263,23.623147;113.676102,23.62283;113.676037,23.622734;113.675786,23.622474;113.675499,23.62227;113.675412,23.62217;113.675378,23.622083;113.675373,23.621832'},\n",
       "   {'lcode': [],\n",
       "    'distance': '245',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.675373,23.621832;113.675391,23.621606;113.675438,23.621471;113.675538,23.621354;113.675764,23.621176;113.675851,23.621085;113.675898,23.62099;113.675911,23.620851;113.675868,23.62072;113.675786,23.620603;113.675742,23.620543;113.675595,23.620369;113.675239,23.620009'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿乌土街向东南行驶412米向右前方行驶',\n",
       "  'orientation': '东南',\n",
       "  'road': '乌土街',\n",
       "  'distance': '412',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '51',\n",
       "  'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619987;113.675773,23.619944;113.676016,23.619792;113.676897,23.619188;113.677261,23.61878;113.678069,23.617826;113.678186,23.617652',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '390',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619987;113.675773,23.619944;113.676016,23.619792;113.676897,23.619188;113.677261,23.61878;113.678069,23.617826'},\n",
       "   {'lcode': [],\n",
       "    'distance': '22',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678069,23.617826;113.678186,23.617652'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿乌土街向南行驶1.4千米左转',\n",
       "  'orientation': '南',\n",
       "  'road': '乌土街',\n",
       "  'distance': '1381',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '205',\n",
       "  'polyline': '113.678186,23.617652;113.678095,23.617201;113.678047,23.61707;113.677969,23.616918;113.677739,23.616554;113.6776,23.616285;113.677387,23.615812;113.677339,23.615664;113.67714,23.614822;113.677049,23.614314;113.676923,23.613355;113.67684,23.612782;113.676593,23.611484;113.676415,23.610434;113.676402,23.61026;113.676489,23.609844;113.676506,23.609618;113.676489,23.609232;113.676411,23.608741;113.676415,23.608481;113.67648,23.608186;113.676606,23.60773;113.676819,23.606732;113.676866,23.606536;113.676918,23.606411;113.677014,23.60625;113.67753,23.605668',\n",
       "  'action': '左转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '844',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.678186,23.617652;113.678095,23.617201;113.678047,23.61707;113.677969,23.616918;113.677739,23.616554;113.6776,23.616285;113.677387,23.615812;113.677339,23.615664;113.67714,23.614822;113.677049,23.614314;113.676923,23.613355;113.67684,23.612782;113.676593,23.611484;113.676415,23.610434;113.676402,23.61026'},\n",
       "   {'lcode': [],\n",
       "    'distance': '537',\n",
       "    'status': '未知',\n",
       "    'polyline': '113.676402,23.61026;113.676489,23.609844;113.676506,23.609618;113.676489,23.609232;113.676411,23.608741;113.676415,23.608481;113.67648,23.608186;113.676606,23.60773;113.676819,23.606732;113.676866,23.606536;113.676918,23.606411;113.677014,23.60625;113.67753,23.605668'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿乌土街途径934县道向东北行驶2.7千米靠左',\n",
       "  'orientation': '东北',\n",
       "  'road': '乌土街',\n",
       "  'distance': '2713',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '198',\n",
       "  'polyline': '113.67753,23.605668;113.677743,23.605777;113.678277,23.605977;113.678663,23.606098;113.67931,23.606259;113.680629,23.606489;113.681076,23.606576;113.681215,23.606597;113.68171,23.606736;113.682513,23.607079;113.683602,23.607591;113.68388,23.60773;113.684722,23.608581;113.685217,23.609106;113.685694,23.609618;113.686523,23.610495;113.686632,23.610621;113.686784,23.610781;113.687986,23.612062;113.68872,23.612821;113.689041,23.613099;113.689327,23.613329;113.68987,23.613715;113.690074,23.613837;113.690221,23.613898;113.69036,23.613937;113.690599,23.61398;113.691211,23.614049;113.692813,23.614223;113.69362,23.614306;113.694015,23.614332;113.69454,23.614375;113.695391,23.61444;113.695621,23.614479;113.695942,23.614553;113.697018,23.61487;113.697222,23.61497;113.697817,23.615404;113.698416,23.61582;113.698997,23.616285;113.7,23.616936',\n",
       "  'action': '靠左',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '83',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.67753,23.605668;113.677743,23.605777;113.678277,23.605977'},\n",
       "   {'lcode': [],\n",
       "    'distance': '110',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.678277,23.605977;113.678663,23.606098;113.67931,23.606259'},\n",
       "   {'lcode': [],\n",
       "    'distance': '136',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.67931,23.606259;113.680629,23.606489'},\n",
       "   {'lcode': [],\n",
       "    'distance': '46',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.680629,23.606489;113.681076,23.606576'},\n",
       "   {'lcode': [],\n",
       "    'distance': '67',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.681076,23.606576;113.681215,23.606597;113.68171,23.606736'},\n",
       "   {'lcode': [],\n",
       "    'distance': '215',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.68171,23.606736;113.682513,23.607079;113.683602,23.607591'},\n",
       "   {'lcode': [],\n",
       "    'distance': '32',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.683602,23.607591;113.68388,23.60773'},\n",
       "   {'lcode': [],\n",
       "    'distance': '127',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.68388,23.60773;113.684722,23.608581'},\n",
       "   {'lcode': [],\n",
       "    'distance': '77',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.684722,23.608581;113.685217,23.609106'},\n",
       "   {'lcode': [],\n",
       "    'distance': '221',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.685217,23.609106;113.685694,23.609618;113.686523,23.610495;113.686632,23.610621'},\n",
       "   {'lcode': [],\n",
       "    'distance': '23',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.686632,23.610621;113.686784,23.610781'},\n",
       "   {'lcode': [],\n",
       "    'distance': '300',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.686784,23.610781;113.687986,23.612062;113.68872,23.612821'},\n",
       "   {'lcode': [],\n",
       "    'distance': '44',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.68872,23.612821;113.689041,23.613099'},\n",
       "   {'lcode': [],\n",
       "    'distance': '252',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.689041,23.613099;113.689327,23.613329;113.68987,23.613715;113.690074,23.613837;113.690221,23.613898;113.69036,23.613937;113.690599,23.61398;113.691211,23.614049'},\n",
       "   {'lcode': [],\n",
       "    'distance': '164',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.691211,23.614049;113.692813,23.614223'},\n",
       "   {'lcode': [],\n",
       "    'distance': '82',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.692813,23.614223;113.69362,23.614306'},\n",
       "   {'lcode': [],\n",
       "    'distance': '40',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.69362,23.614306;113.694015,23.614332'},\n",
       "   {'lcode': [],\n",
       "    'distance': '53',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.694015,23.614332;113.69454,23.614375'},\n",
       "   {'lcode': [],\n",
       "    'distance': '437',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.69454,23.614375;113.695391,23.61444;113.695621,23.614479;113.695942,23.614553;113.697018,23.61487;113.697222,23.61497;113.697817,23.615404;113.698416,23.61582'},\n",
       "   {'lcode': [],\n",
       "    'distance': '204',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.698416,23.61582;113.698997,23.616285;113.7,23.616936'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿934县道向东行驶344米向右前方行驶',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '344',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '40',\n",
       "  'polyline': '113.7,23.616936;113.700143,23.617027;113.700304,23.61707;113.701736,23.617188;113.701949,23.617222;113.702088,23.61727;113.702214,23.617335;113.70299,23.617847;113.703108,23.617938',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '218',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.7,23.616936;113.700143,23.617027;113.700304,23.61707;113.701736,23.617188;113.701949,23.617222;113.702088,23.61727'},\n",
       "   {'lcode': [],\n",
       "    'distance': '14',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.702088,23.61727;113.702214,23.617335'},\n",
       "   {'lcode': [],\n",
       "    'distance': '97',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.702214,23.617335;113.70299,23.617847'},\n",
       "   {'lcode': [],\n",
       "    'distance': '15',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.70299,23.617847;113.703108,23.617938'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿934县道途径桃田岗街、中田石井街向东行驶6.2千米右转',\n",
       "  'orientation': '东',\n",
       "  'road': '934县道',\n",
       "  'distance': '6160',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '659',\n",
       "  'polyline': '113.703108,23.617938;113.704553,23.618125;113.704948,23.618168;113.70503,23.618173;113.705286,23.618194;113.706445,23.618325;113.707296,23.618398;113.70776,23.618442;113.708329,23.618507;113.708494,23.618516;113.709032,23.618559;113.70924,23.618585;113.709431,23.618641;113.711089,23.61918;113.711727,23.619397;113.711966,23.619497;113.712344,23.619679;113.712891,23.619926;113.71342,23.620174;113.713681,23.620278;113.714049,23.620395;113.714748,23.620603;113.714991,23.620686;113.715139,23.620755;113.71579,23.621107;113.716102,23.621259;113.716332,23.62135;113.718967,23.622031;113.720321,23.622378;113.720747,23.622483;113.720955,23.622509;113.721111,23.622509;113.721662,23.622448;113.722973,23.62217;113.725122,23.621719;113.726984,23.621324;113.72753,23.621202;113.72773,23.621163;113.728155,23.621081;113.728789,23.620951;113.729019,23.620907;113.729592,23.620781;113.730061,23.620703;113.730412,23.620677;113.730469,23.620677;113.730564,23.620673;113.731341,23.62072;113.731819,23.620768;113.732027,23.620803;113.732161,23.620838;113.732595,23.621007;113.733459,23.621376;113.733598,23.621419;113.733776,23.621445;113.734214,23.621489;113.734453,23.621493;113.734727,23.621476;113.737179,23.621259;113.737665,23.621224;113.737964,23.62122;113.738116,23.621237;113.738273,23.62128;113.738733,23.621441;113.739045,23.621541;113.739249,23.621584;113.740408,23.621801;113.741888,23.62201;113.742066,23.622018;113.742678,23.621975;113.743207,23.621944;113.743346,23.621953;113.743572,23.622005;113.744444,23.6223;113.744622,23.622322;113.744709,23.622309;113.744822,23.622257;113.745078,23.622075;113.745139,23.62201;113.745278,23.621745;113.745373,23.621619;113.745469,23.621576;113.745582,23.621576;113.745781,23.621658;113.746272,23.621953;113.74674,23.622292;113.747865,23.622695;113.74796,23.622747;113.748138,23.622882;113.748511,23.623194;113.748759,23.623429;113.748915,23.623559;113.749015,23.623611;113.749188,23.623646;113.749275,23.623641;113.749371,23.623611;113.749531,23.62352;113.749618,23.623424;113.750004,23.622817;113.750234,23.622491;113.750399,23.622279;113.750534,23.622036;113.750638,23.621923;113.750846,23.621827;113.751411,23.621623;113.751662,23.621549;113.751771,23.621493;113.752075,23.621246;113.752166,23.621189;113.752296,23.621146;113.7524,23.621128;113.752439,23.621128;113.752582,23.621128;113.752756,23.621146;113.752869,23.621172;113.752943,23.621202;113.753125,23.621345;113.753893,23.62174;113.754006,23.621784;113.754128,23.621806;113.754227,23.621806;113.754605,23.621693;113.754735,23.621697;113.754822,23.621732;113.754913,23.621793;113.754987,23.621875;113.755234,23.622244;113.755326,23.622313;113.755443,23.622352;113.755694,23.622309;113.755786,23.622305;113.755864,23.622326;113.755933,23.622374;113.756059,23.622517;113.756128,23.622578;113.756263,23.62263;113.756354,23.622635;113.756437,23.622609;113.756463,23.622578;113.75648,23.62253;113.756458,23.622444;113.756324,23.622261;113.756298,23.622187;113.756306,23.622075;113.756372,23.62201;113.756419,23.621992;113.756536,23.622014;113.757183,23.622192;113.757244,23.622196;113.757357,23.622166;113.757639,23.621997;113.757734,23.621975;113.757804,23.622014;113.757826,23.622053;113.757873,23.622257;113.757912,23.622357;113.757956,23.6224;113.758012,23.622422',\n",
       "  'action': '右转',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '148',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.703108,23.617938;113.704553,23.618125'},\n",
       "   {'lcode': [],\n",
       "    'distance': '48',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.704553,23.618125;113.704948,23.618168;113.70503,23.618173'},\n",
       "   {'lcode': [],\n",
       "    'distance': '26',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.70503,23.618173;113.705286,23.618194'},\n",
       "   {'lcode': [],\n",
       "    'distance': '119',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.705286,23.618194;113.706445,23.618325'},\n",
       "   {'lcode': [],\n",
       "    'distance': '87',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.706445,23.618325;113.707296,23.618398'},\n",
       "   {'lcode': [],\n",
       "    'distance': '47',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.707296,23.618398;113.70776,23.618442'},\n",
       "   {'lcode': [],\n",
       "    'distance': '151',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.70776,23.618442;113.708329,23.618507;113.708494,23.618516;113.709032,23.618559;113.70924,23.618585'},\n",
       "   {'lcode': [],\n",
       "    'distance': '295',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.70924,23.618585;113.709431,23.618641;113.711089,23.61918;113.711727,23.619397;113.711966,23.619497'},\n",
       "   {'lcode': [],\n",
       "    'distance': '44',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.711966,23.619497;113.712344,23.619679'},\n",
       "   {'lcode': [],\n",
       "    'distance': '61',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.712344,23.619679;113.712891,23.619926'},\n",
       "   {'lcode': [],\n",
       "    'distance': '89',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.712891,23.619926;113.71342,23.620174;113.713681,23.620278'},\n",
       "   {'lcode': [],\n",
       "    'distance': '40',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.713681,23.620278;113.714049,23.620395'},\n",
       "   {'lcode': [],\n",
       "    'distance': '101',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.714049,23.620395;113.714748,23.620603;113.714991,23.620686'},\n",
       "   {'lcode': [],\n",
       "    'distance': '16',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.714991,23.620686;113.715139,23.620755'},\n",
       "   {'lcode': [],\n",
       "    'distance': '417',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.715139,23.620755;113.71579,23.621107;113.716102,23.621259;113.716332,23.62135;113.718967,23.622031'},\n",
       "   {'lcode': [],\n",
       "    'distance': '144',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.718967,23.622031;113.720321,23.622378'},\n",
       "   {'lcode': [],\n",
       "    'distance': '44',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.720321,23.622378;113.720747,23.622483'},\n",
       "   {'lcode': [],\n",
       "    'distance': '231',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.720747,23.622483;113.720955,23.622509;113.721111,23.622509;113.721662,23.622448;113.722973,23.62217'},\n",
       "   {'lcode': [],\n",
       "    'distance': '225',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.722973,23.62217;113.725122,23.621719'},\n",
       "   {'lcode': [],\n",
       "    'distance': '195',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.725122,23.621719;113.726984,23.621324'},\n",
       "   {'lcode': [],\n",
       "    'distance': '57',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.726984,23.621324;113.72753,23.621202'},\n",
       "   {'lcode': [],\n",
       "    'distance': '21',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.72753,23.621202;113.72773,23.621163'},\n",
       "   {'lcode': [],\n",
       "    'distance': '44',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.72773,23.621163;113.728155,23.621081'},\n",
       "   {'lcode': [],\n",
       "    'distance': '66',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.728155,23.621081;113.728789,23.620951'},\n",
       "   {'lcode': [],\n",
       "    'distance': '24',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.728789,23.620951;113.729019,23.620907'},\n",
       "   {'lcode': [],\n",
       "    'distance': '239',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.729019,23.620907;113.729592,23.620781;113.730061,23.620703;113.730412,23.620677;113.730469,23.620677;113.730564,23.620673;113.731341,23.62072'},\n",
       "   {'lcode': [],\n",
       "    'distance': '612',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.731341,23.62072;113.731819,23.620768;113.732027,23.620803;113.732161,23.620838;113.732595,23.621007;113.733459,23.621376;113.733598,23.621419;113.733776,23.621445;113.734214,23.621489;113.734453,23.621493;113.734727,23.621476;113.737179,23.621259'},\n",
       "   {'lcode': [],\n",
       "    'distance': '95',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.737179,23.621259;113.737665,23.621224;113.737964,23.62122;113.738116,23.621237'},\n",
       "   {'lcode': [],\n",
       "    'distance': '67',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.738116,23.621237;113.738273,23.62128;113.738733,23.621441'},\n",
       "   {'lcode': [],\n",
       "    'distance': '55',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.738733,23.621441;113.739045,23.621541;113.739249,23.621584'},\n",
       "   {'lcode': [],\n",
       "    'distance': '353',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.739249,23.621584;113.740408,23.621801;113.741888,23.62201;113.742066,23.622018;113.742678,23.621975'},\n",
       "   {'lcode': [],\n",
       "    'distance': '643',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.742678,23.621975;113.743207,23.621944;113.743346,23.621953;113.743572,23.622005;113.744444,23.6223;113.744622,23.622322;113.744709,23.622309;113.744822,23.622257;113.745078,23.622075;113.745139,23.62201;113.745278,23.621745;113.745373,23.621619;113.745469,23.621576;113.745582,23.621576;113.745781,23.621658;113.746272,23.621953;113.74674,23.622292;113.747865,23.622695;113.74796,23.622747;113.748138,23.622882'},\n",
       "   {'lcode': [],\n",
       "    'distance': '191',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.748138,23.622882;113.748511,23.623194;113.748759,23.623429;113.748915,23.623559;113.749015,23.623611;113.749188,23.623646;113.749275,23.623641;113.749371,23.623611;113.749531,23.62352;113.749618,23.623424'},\n",
       "   {'lcode': [],\n",
       "    'distance': '388',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.749618,23.623424;113.750004,23.622817;113.750234,23.622491;113.750399,23.622279;113.750534,23.622036;113.750638,23.621923;113.750846,23.621827;113.751411,23.621623;113.751662,23.621549;113.751771,23.621493;113.752075,23.621246;113.752166,23.621189;113.752296,23.621146'},\n",
       "   {'lcode': [],\n",
       "    'distance': '29',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.752296,23.621146;113.7524,23.621128;113.752439,23.621128;113.752582,23.621128'},\n",
       "   {'lcode': [],\n",
       "    'distance': '322',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.752582,23.621128;113.752756,23.621146;113.752869,23.621172;113.752943,23.621202;113.753125,23.621345;113.753893,23.62174;113.754006,23.621784;113.754128,23.621806;113.754227,23.621806;113.754605,23.621693;113.754735,23.621697;113.754822,23.621732;113.754913,23.621793;113.754987,23.621875;113.755234,23.622244'},\n",
       "   {'lcode': [],\n",
       "    'distance': '426',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.755234,23.622244;113.755326,23.622313;113.755443,23.622352;113.755694,23.622309;113.755786,23.622305;113.755864,23.622326;113.755933,23.622374;113.756059,23.622517;113.756128,23.622578;113.756263,23.62263;113.756354,23.622635;113.756437,23.622609;113.756463,23.622578;113.75648,23.62253;113.756458,23.622444;113.756324,23.622261;113.756298,23.622187;113.756306,23.622075;113.756372,23.62201;113.756419,23.621992;113.756536,23.622014;113.757183,23.622192;113.757244,23.622196;113.757357,23.622166;113.757639,23.621997;113.757734,23.621975;113.757804,23.622014;113.757826,23.622053;113.757873,23.622257;113.757912,23.622357;113.757956,23.6224;113.758012,23.622422'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿934县道向东南行驶12米向右前方行驶',\n",
       "  'orientation': '东南',\n",
       "  'road': '934县道',\n",
       "  'distance': '12',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '8',\n",
       "  'polyline': '113.758012,23.622422;113.758073,23.622413;113.758116,23.62237',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '12',\n",
       "    'status': '缓行',\n",
       "    'polyline': '113.758012,23.622422;113.758073,23.622413;113.758116,23.62237'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿934县道向东北行驶1.8千米向右前方行驶',\n",
       "  'orientation': '东北',\n",
       "  'road': '934县道',\n",
       "  'distance': '1804',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '324',\n",
       "  'polyline': '113.758116,23.62237;113.75816,23.622287;113.75819,23.62217;113.758151,23.621788;113.758151,23.62171;113.758173,23.621645;113.758242,23.621554;113.758312,23.621506;113.758437,23.621445;113.758767,23.621359;113.758941,23.621337;113.759054,23.621293;113.759093,23.621259;113.759119,23.621202;113.759123,23.62115;113.759093,23.62102;113.759097,23.620972;113.759128,23.620907;113.759232,23.620807;113.759349,23.620725;113.759575,23.620603;113.759696,23.620595;113.759731,23.620603;113.759774,23.620625;113.7598,23.620664;113.7598,23.620725;113.759731,23.62092;113.759731,23.621016;113.759757,23.621181;113.759965,23.621892;113.759987,23.622326;113.760017,23.622357;113.760161,23.622413;113.760321,23.622439;113.760356,23.622474;113.760369,23.622517;113.76033,23.622613;113.760278,23.622678;113.760104,23.622834;113.760013,23.622938;113.759957,23.623034;113.759857,23.623346;113.75967,23.623802;113.759666,23.623941;113.759674,23.623997;113.759718,23.624102;113.759983,23.624596;113.760104,23.62487;113.760208,23.625035;113.760352,23.625213;113.761163,23.626042;113.76122,23.626085;113.761324,23.626076;113.761372,23.626029;113.761419,23.625916;113.761428,23.625803;113.761016,23.624835;113.761003,23.624744;113.761016,23.624674;113.761042,23.624627;113.761254,23.624431;113.761337,23.624379;113.761736,23.624132;113.761944,23.623984;113.762292,23.623628;113.762391,23.623568;113.76273,23.623468;113.76286,23.623403;113.76296,23.623333;113.763207,23.62309;113.763437,23.622739;113.763503,23.622656;113.763559,23.622613;113.763628,23.622582;113.763676,23.622587;113.763711,23.622609;113.76372,23.622635;113.76372,23.622687;113.763646,23.622839;113.76362,23.622947;113.763555,23.623451;113.76349,23.623715;113.763442,23.623898;113.763403,23.623971;113.763355,23.624041;113.763168,23.62421;113.763086,23.624332;113.76303,23.624544;113.763034,23.624648',\n",
       "  'action': '向右前方行驶',\n",
       "  'assistant_action': [],\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '353',\n",
       "    'status': '缓行',\n",
       "    'polyline': '113.758116,23.62237;113.75816,23.622287;113.75819,23.62217;113.758151,23.621788;113.758151,23.62171;113.758173,23.621645;113.758242,23.621554;113.758312,23.621506;113.758437,23.621445;113.758767,23.621359;113.758941,23.621337;113.759054,23.621293;113.759093,23.621259;113.759119,23.621202;113.759123,23.62115;113.759093,23.62102;113.759097,23.620972;113.759128,23.620907;113.759232,23.620807;113.759349,23.620725;113.759575,23.620603;113.759696,23.620595;113.759731,23.620603;113.759774,23.620625;113.7598,23.620664;113.7598,23.620725;113.759731,23.62092;113.759731,23.621016'},\n",
       "   {'lcode': [],\n",
       "    'distance': '887',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.759731,23.621016;113.759757,23.621181;113.759965,23.621892;113.759987,23.622326;113.760017,23.622357;113.760161,23.622413;113.760321,23.622439;113.760356,23.622474;113.760369,23.622517;113.76033,23.622613;113.760278,23.622678;113.760104,23.622834;113.760013,23.622938;113.759957,23.623034;113.759857,23.623346;113.75967,23.623802;113.759666,23.623941;113.759674,23.623997;113.759718,23.624102;113.759983,23.624596;113.760104,23.62487;113.760208,23.625035;113.760352,23.625213;113.761163,23.626042;113.76122,23.626085;113.761324,23.626076;113.761372,23.626029;113.761419,23.625916;113.761428,23.625803;113.761016,23.624835;113.761003,23.624744;113.761016,23.624674;113.761042,23.624627;113.761254,23.624431;113.761337,23.624379'},\n",
       "   {'lcode': [],\n",
       "    'distance': '241',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.761337,23.624379;113.761736,23.624132;113.761944,23.623984;113.762292,23.623628;113.762391,23.623568;113.76273,23.623468;113.76286,23.623403;113.76296,23.623333;113.763207,23.62309'},\n",
       "   {'lcode': [],\n",
       "    'distance': '82',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.763207,23.62309;113.763437,23.622739;113.763503,23.622656;113.763559,23.622613;113.763628,23.622582;113.763676,23.622587;113.763711,23.622609'},\n",
       "   {'lcode': [],\n",
       "    'distance': '95',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.763711,23.622609;113.76372,23.622635;113.76372,23.622687;113.763646,23.622839;113.76362,23.622947;113.763555,23.623451'},\n",
       "   {'lcode': [],\n",
       "    'distance': '29',\n",
       "    'status': '畅通',\n",
       "    'polyline': '113.763555,23.623451;113.76349,23.623715'},\n",
       "   {'lcode': [],\n",
       "    'distance': '117',\n",
       "    'status': '拥堵',\n",
       "    'polyline': '113.76349,23.623715;113.763442,23.623898;113.763403,23.623971;113.763355,23.624041;113.763168,23.62421;113.763086,23.624332;113.76303,23.624544;113.763034,23.624648'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       " {'instruction': '沿934县道向东北行驶56米到达目的地',\n",
       "  'orientation': '东北',\n",
       "  'road': '934县道',\n",
       "  'distance': '56',\n",
       "  'tolls': '0',\n",
       "  'toll_distance': '0',\n",
       "  'toll_road': [],\n",
       "  'duration': '41',\n",
       "  'polyline': '113.763034,23.624648;113.763056,23.624744;113.763103,23.624839;113.763273,23.6251',\n",
       "  'action': [],\n",
       "  'assistant_action': '到达目的地',\n",
       "  'tmcs': [{'lcode': [],\n",
       "    'distance': '56',\n",
       "    'status': '严重拥堵',\n",
       "    'polyline': '113.763034,23.624648;113.763056,23.624744;113.763103,23.624839;113.763273,23.6251'}],\n",
       "  'cities': [{'name': '广州市',\n",
       "    'citycode': '020',\n",
       "    'adcode': '440100',\n",
       "    'districts': [{'name': '从化区', 'adcode': '440117'}]}]}]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "carcar['route']['paths'][0]['steps']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>行驶指示</th>\n",
       "      <th>方向</th>\n",
       "      <th>此路段距离</th>\n",
       "      <th>预计行驶时间(秒)</th>\n",
       "      <th>导航主要动作</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>向南行驶9米左转</td>\n",
       "      <td>南</td>\n",
       "      <td>9</td>\n",
       "      <td>8</td>\n",
       "      <td>左转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>向东行驶100米右转</td>\n",
       "      <td>东</td>\n",
       "      <td>100</td>\n",
       "      <td>28</td>\n",
       "      <td>右转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>向南行驶199米向右前方行驶</td>\n",
       "      <td>南</td>\n",
       "      <td>199</td>\n",
       "      <td>47</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>向西行驶159米左转</td>\n",
       "      <td>西</td>\n",
       "      <td>159</td>\n",
       "      <td>36</td>\n",
       "      <td>左转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>向南行驶237米左转</td>\n",
       "      <td>南</td>\n",
       "      <td>237</td>\n",
       "      <td>65</td>\n",
       "      <td>左转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>向东南行驶105米向右前方行驶</td>\n",
       "      <td>东南</td>\n",
       "      <td>105</td>\n",
       "      <td>51</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>向南行驶393米向右前方行驶</td>\n",
       "      <td>南</td>\n",
       "      <td>393</td>\n",
       "      <td>66</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>向西南行驶722米左转</td>\n",
       "      <td>西南</td>\n",
       "      <td>722</td>\n",
       "      <td>98</td>\n",
       "      <td>左转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>沿乌土街向东南行驶412米向右前方行驶</td>\n",
       "      <td>东南</td>\n",
       "      <td>412</td>\n",
       "      <td>51</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>沿乌土街向南行驶1.4千米左转</td>\n",
       "      <td>南</td>\n",
       "      <td>1381</td>\n",
       "      <td>205</td>\n",
       "      <td>左转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>沿乌土街途径934县道向东北行驶2.7千米靠左</td>\n",
       "      <td>东北</td>\n",
       "      <td>2713</td>\n",
       "      <td>198</td>\n",
       "      <td>靠左</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>沿934县道向东行驶344米向右前方行驶</td>\n",
       "      <td>东</td>\n",
       "      <td>344</td>\n",
       "      <td>40</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>沿934县道途径桃田岗街、中田石井街向东行驶6.2千米右转</td>\n",
       "      <td>东</td>\n",
       "      <td>6160</td>\n",
       "      <td>659</td>\n",
       "      <td>右转</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>沿934县道向东南行驶12米向右前方行驶</td>\n",
       "      <td>东南</td>\n",
       "      <td>12</td>\n",
       "      <td>8</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>沿934县道向东北行驶1.8千米向右前方行驶</td>\n",
       "      <td>东北</td>\n",
       "      <td>1804</td>\n",
       "      <td>324</td>\n",
       "      <td>向右前方行驶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>沿934县道向东北行驶56米到达目的地</td>\n",
       "      <td>东北</td>\n",
       "      <td>56</td>\n",
       "      <td>41</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             行驶指示  方向 此路段距离 预计行驶时间(秒)  导航主要动作\n",
       "0                        向南行驶9米左转   南     9         8      左转\n",
       "1                      向东行驶100米右转   东   100        28      右转\n",
       "2                  向南行驶199米向右前方行驶   南   199        47  向右前方行驶\n",
       "3                      向西行驶159米左转   西   159        36      左转\n",
       "4                      向南行驶237米左转   南   237        65      左转\n",
       "5                 向东南行驶105米向右前方行驶  东南   105        51  向右前方行驶\n",
       "6                  向南行驶393米向右前方行驶   南   393        66  向右前方行驶\n",
       "7                     向西南行驶722米左转  西南   722        98      左转\n",
       "8             沿乌土街向东南行驶412米向右前方行驶  东南   412        51  向右前方行驶\n",
       "9                 沿乌土街向南行驶1.4千米左转   南  1381       205      左转\n",
       "10        沿乌土街途径934县道向东北行驶2.7千米靠左  东北  2713       198      靠左\n",
       "11           沿934县道向东行驶344米向右前方行驶   东   344        40  向右前方行驶\n",
       "12  沿934县道途径桃田岗街、中田石井街向东行驶6.2千米右转   东  6160       659      右转\n",
       "13           沿934县道向东南行驶12米向右前方行驶  东南    12         8  向右前方行驶\n",
       "14         沿934县道向东北行驶1.8千米向右前方行驶  东北  1804       324  向右前方行驶\n",
       "15            沿934县道向东北行驶56米到达目的地  东北    56        41      []"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.json_normalize(carcar['route']['paths'][0]['steps'])[['instruction','orientation','distance','duration','action']]\n",
    "df_car = df.rename(columns={'instruction':\"行驶指示\",\\\n",
    "                           'orientation':\"方向\",\n",
    "                           \"distance\":\"此路段距离\",\n",
    "                           \"duration\":\"预计行驶时间(秒)\",\n",
    "                           'action':\"导航主要动作\"  \n",
    "})\n",
    "df_car"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 骑行路径规划\n",
    "- 接口简介：驾车路径规划 API 可以规划以小客车、轿车通勤出行的方案，并且返回通勤方案的数据。\n",
    "- 请求URL：https://restapi.amap.com/v4/direction/bicycling?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,origin,destination（经纬度）\n",
    ">2. 选填："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "bike_origin = geocode(key1_key,\"广东省广州市中山大学南方学院\")\n",
    "bike_destination = geocode(key1_key,\"广东省广州市石门国家森林公园\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'action': '右转',\n",
       "  'assistant_action': '',\n",
       "  'distance': 101,\n",
       "  'duration': 24,\n",
       "  'instruction': '向东骑行101米右转',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.679592,23.632491;113.680586,23.632522',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '向右前方行驶',\n",
       "  'assistant_action': '',\n",
       "  'distance': 199,\n",
       "  'duration': 48,\n",
       "  'instruction': '向南骑行199米向右前方行驶',\n",
       "  'orientation': '南',\n",
       "  'polyline': '113.680586,23.632522;113.680638,23.63214;113.680668,23.63174;113.680634,23.631541;113.68059,23.631437;113.68059,23.631437;113.680499,23.631241;113.680408,23.631094;113.680208,23.630842',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '左转',\n",
       "  'assistant_action': '',\n",
       "  'distance': 159,\n",
       "  'duration': 38,\n",
       "  'instruction': '向西骑行159米左转',\n",
       "  'orientation': '西',\n",
       "  'polyline': '113.680204,23.630838;113.680035,23.630773;113.680035,23.630773;113.679644,23.630638;113.679644,23.630638;113.679362,23.630521;113.679201,23.630473;113.679201,23.630473;113.679032,23.63043;113.679032,23.63043;113.67888,23.630404;113.67888,23.630404;113.678711,23.630365',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '左转',\n",
       "  'assistant_action': '',\n",
       "  'distance': 237,\n",
       "  'duration': 57,\n",
       "  'instruction': '向南骑行237米左转',\n",
       "  'orientation': '南',\n",
       "  'polyline': '113.678711,23.63036;113.678711,23.62934;113.678711,23.62934;113.678711,23.629193;113.678689,23.629084;113.678637,23.629023;113.678424,23.628902;113.678368,23.628841;113.678316,23.628724;113.678294,23.628611;113.678294,23.628611;113.678277,23.628372',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '向右前方行驶',\n",
       "  'assistant_action': '',\n",
       "  'distance': 498,\n",
       "  'duration': 120,\n",
       "  'instruction': '向南骑行498米向右前方行驶',\n",
       "  'orientation': '南',\n",
       "  'polyline': '113.678273,23.628368;113.678572,23.628338;113.678685,23.628307;113.678685,23.628307;113.678845,23.628234;113.679045,23.628073;113.679158,23.627964;113.679158,23.627964;113.679214,23.627869;113.679236,23.627778;113.67928,23.627526;113.679288,23.627322;113.679288,23.627322;113.679253,23.626853;113.679184,23.626623;113.679141,23.626497;113.679002,23.626259;113.678941,23.626176;113.678711,23.625977;113.67862,23.625864;113.678529,23.62572;113.678438,23.625191;113.678429,23.625056;113.678451,23.624939;113.678572,23.624657',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '左转',\n",
       "  'assistant_action': '',\n",
       "  'distance': 722,\n",
       "  'duration': 173,\n",
       "  'instruction': '向西南骑行722米左转',\n",
       "  'orientation': '西南',\n",
       "  'polyline': '113.678572,23.624653;113.678559,23.62451;113.678416,23.624323;113.678416,23.624323;113.677582,23.623793;113.676532,23.623346;113.676363,23.623255;113.676272,23.623151;113.676111,23.622834;113.676042,23.622739;113.67579,23.622483;113.675499,23.622279;113.675417,23.622174;113.675386,23.622088;113.675378,23.621836;113.675378,23.621836;113.675391,23.62161;113.675434,23.621476;113.675543,23.621359;113.675764,23.621181;113.675846,23.621089;113.675903,23.620994;113.675907,23.620855;113.675877,23.620725;113.675747,23.620547;113.675599,23.620373;113.675243,23.620013',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '向右前方行驶',\n",
       "  'assistant_action': '',\n",
       "  'distance': 412,\n",
       "  'duration': 99,\n",
       "  'instruction': '向东南骑行412米向右前方行驶',\n",
       "  'orientation': '东南',\n",
       "  'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619991;113.675773,23.619948;113.676016,23.619796;113.676901,23.619193;113.677261,23.618785;113.678069,23.61783;113.678069,23.61783;113.678181,23.617656',\n",
       "  'road': '',\n",
       "  'walk_type': 0},\n",
       " {'action': '左转',\n",
       "  'assistant_action': '',\n",
       "  'distance': 1381,\n",
       "  'duration': 331,\n",
       "  'instruction': '沿乌土街向南骑行1381米左转',\n",
       "  'orientation': '南',\n",
       "  'polyline': '113.678181,23.617652;113.678095,23.617205;113.678051,23.617075;113.677973,23.616923;113.677743,23.616558;113.677609,23.616289;113.677391,23.615816;113.677339,23.615668;113.67714,23.614826;113.677049,23.614323;113.676927,23.613359;113.676845,23.612786;113.676602,23.611489;113.676415,23.610438;113.676411,23.610265;113.676411,23.610265;113.676489,23.609848;113.676502,23.609622;113.676493,23.609236;113.676415,23.608746;113.676415,23.608485;113.67648,23.60819;113.67661,23.607734;113.676819,23.606736;113.676862,23.606541;113.676914,23.606415;113.677014,23.606254;113.677535,23.605673',\n",
       "  'road': '乌土街',\n",
       "  'walk_type': 0},\n",
       " {'action': '直行',\n",
       "  'assistant_action': '',\n",
       "  'distance': 83,\n",
       "  'duration': 20,\n",
       "  'instruction': '沿乌土街向东北骑行83米直行',\n",
       "  'orientation': '东北',\n",
       "  'polyline': '113.677535,23.605668;113.677747,23.605777;113.678273,23.605972',\n",
       "  'road': '乌土街',\n",
       "  'walk_type': 0},\n",
       " {'action': None,\n",
       "  'assistant_action': '',\n",
       "  'distance': 2630,\n",
       "  'duration': 631,\n",
       "  'instruction': '沿934县道向东北骑行2630米null',\n",
       "  'orientation': '东北',\n",
       "  'polyline': '113.678273,23.605972;113.678663,23.606098;113.67931,23.606259;113.67931,23.606259;113.680629,23.606489;113.680629,23.606489;113.681072,23.606576;113.681072,23.606576;113.68122,23.606597;113.681706,23.606736;113.681706,23.606736;113.682517,23.607079;113.683607,23.607591;113.683607,23.607591;113.68388,23.60773;113.68388,23.60773;113.684722,23.608581;113.684722,23.608581;113.685217,23.609106;113.685217,23.609106;113.686636,23.610621;113.686636,23.610621;113.68678,23.610781;113.68678,23.610781;113.687986,23.612062;113.68872,23.612821;113.68872,23.612821;113.689041,23.613099;113.689041,23.613099;113.689327,23.613329;113.68987,23.613715;113.690069,23.613837;113.690221,23.613898;113.69036,23.613937;113.690595,23.61398;113.691215,23.614049;113.691215,23.614049;113.692817,23.614223;113.692817,23.614223;113.693615,23.614306;113.693615,23.614306;113.694015,23.614332;113.694015,23.614332;113.69454,23.614375;113.69454,23.614375;113.695386,23.61444;113.695616,23.614475;113.695942,23.614553;113.697018,23.61487;113.697227,23.61497;113.697821,23.615404;113.698416,23.615816;113.698416,23.615816;113.698997,23.616285;113.700004,23.616931',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '向右前方行驶',\n",
       "  'assistant_action': '',\n",
       "  'distance': 344,\n",
       "  'duration': 83,\n",
       "  'instruction': '沿934县道向东骑行344米向右前方行驶',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.700004,23.616931;113.700139,23.617027;113.700299,23.61707;113.701736,23.617188;113.701949,23.617222;113.702083,23.61727;113.702083,23.61727;113.702214,23.617335;113.702214,23.617335;113.702995,23.617847;113.702995,23.617847;113.703108,23.617938',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '直行',\n",
       "  'assistant_action': '',\n",
       "  'distance': 474,\n",
       "  'duration': 114,\n",
       "  'instruction': '沿934县道向东骑行474米直行',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.703108,23.617938;113.704549,23.618125;113.704549,23.618125;113.704948,23.618168;113.704948,23.618168;113.70503,23.618173;113.70503,23.618173;113.705291,23.618194;113.705291,23.618194;113.706441,23.618325;113.706441,23.618325;113.707296,23.618398;113.707296,23.618398;113.70776,23.618442',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '直行',\n",
       "  'assistant_action': '',\n",
       "  'distance': 640,\n",
       "  'duration': 154,\n",
       "  'instruction': '沿中田石井街向东骑行640米直行',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.70776,23.618442;113.708325,23.618507;113.709028,23.618559;113.70924,23.618585;113.70924,23.618585;113.709431,23.618641;113.711727,23.619397;113.711966,23.619501;113.711966,23.619501;113.712348,23.619679;113.712348,23.619679;113.712895,23.619926;113.712895,23.619926;113.713416,23.620174;113.713681,23.620273',\n",
       "  'road': '中田石井街',\n",
       "  'walk_type': 0},\n",
       " {'action': '直行',\n",
       "  'assistant_action': '',\n",
       "  'distance': 157,\n",
       "  'duration': 38,\n",
       "  'instruction': '沿934县道向东骑行157米直行',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.713681,23.620273;113.714049,23.620395;113.714049,23.620395;113.714987,23.620681;113.714987,23.620681;113.715139,23.620755',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '直行',\n",
       "  'assistant_action': '',\n",
       "  'distance': 2889,\n",
       "  'duration': 693,\n",
       "  'instruction': '沿桃田岗街向东骑行2889米直行',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.715139,23.620755;113.715786,23.621107;113.716102,23.621259;113.716328,23.62135;113.718963,23.622031;113.718963,23.622031;113.720321,23.622378;113.720321,23.622378;113.720747,23.622478;113.720747,23.622478;113.720955,23.622509;113.721111,23.622509;113.721662,23.622452;113.722973,23.622174;113.722973,23.622174;113.725126,23.621723;113.725126,23.621723;113.726988,23.621328;113.726988,23.621328;113.72753,23.621207;113.72753,23.621207;113.727726,23.621163;113.727726,23.621163;113.728155,23.621085;113.728155,23.621085;113.728789,23.620955;113.728789,23.620955;113.729019,23.620911;113.729019,23.620911;113.729588,23.620786;113.730061,23.620707;113.730412,23.620681;113.730564,23.620677;113.731345,23.62072;113.731345,23.62072;113.731819,23.620768;113.732031,23.620803;113.732161,23.620838;113.732595,23.621007;113.733459,23.621376;113.733602,23.621419;113.733776,23.621445;113.734214,23.621489;113.734449,23.621493;113.734722,23.62148;113.737179,23.621263;113.737179,23.621263;113.737669,23.621228;113.737964,23.621224;113.738121,23.621237;113.738121,23.621237;113.738273,23.62128;113.738737,23.621441;113.738737,23.621441;113.739041,23.621541;113.739249,23.621584;113.739249,23.621584;113.740408,23.621801;113.741888,23.62201;113.742062,23.622018;113.742674,23.621979',\n",
       "  'road': '桃田岗街',\n",
       "  'walk_type': 0},\n",
       " {'action': None,\n",
       "  'assistant_action': '',\n",
       "  'distance': 1222,\n",
       "  'duration': 293,\n",
       "  'instruction': '沿934县道向东骑行1222米null',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.742674,23.621975;113.743207,23.621949;113.743346,23.621957;113.743572,23.622005;113.744444,23.6223;113.744627,23.622322;113.744709,23.622313;113.744826,23.622261;113.745078,23.622079;113.745139,23.622014;113.745273,23.621749;113.745373,23.621623;113.745473,23.62158;113.745582,23.62158;113.745777,23.621658;113.746267,23.621957;113.74674,23.622292;113.74786,23.622695;113.74796,23.622747;113.748138,23.622882;113.748138,23.622882;113.748511,23.623194;113.748763,23.623429;113.748915,23.623559;113.749015,23.623611;113.749188,23.623646;113.749275,23.623646;113.749371,23.623615;113.749531,23.623524;113.749618,23.623429;113.749618,23.623429;113.750004,23.622826;113.750234,23.622496;113.750404,23.622283;113.750534,23.62204;113.750638,23.621927;113.750846,23.621832;113.751411,23.621628;113.751662,23.621554;113.751766,23.621497;113.752075,23.621254;113.752166,23.621194;113.752296,23.62115',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '向右前方行驶',\n",
       "  'assistant_action': '',\n",
       "  'distance': 777,\n",
       "  'duration': 186,\n",
       "  'instruction': '沿934县道向东骑行777米向右前方行驶',\n",
       "  'orientation': '东',\n",
       "  'polyline': '113.752296,23.621146;113.7524,23.621133;113.752582,23.621133;113.752582,23.621133;113.752752,23.621146;113.752865,23.621172;113.752943,23.621202;113.753125,23.621345;113.753898,23.62174;113.754002,23.621784;113.754123,23.621806;113.754223,23.621806;113.754605,23.621697;113.754735,23.621697;113.754818,23.621732;113.754913,23.621793;113.754987,23.621875;113.75523,23.622244;113.75523,23.622244;113.755321,23.622313;113.755447,23.622352;113.755699,23.622313;113.75579,23.622309;113.755864,23.622326;113.755933,23.622374;113.756063,23.622517;113.756133,23.622578;113.756263,23.62263;113.756354,23.622635;113.756437,23.622613;113.756458,23.622582;113.756476,23.622535;113.756463,23.622448;113.756328,23.622266;113.756302,23.622192;113.756306,23.622079;113.756367,23.622014;113.756424,23.621997;113.756536,23.622014;113.757183,23.622192;113.757244,23.622196;113.757361,23.622166;113.757635,23.622001;113.757734,23.621979;113.757804,23.622014;113.757826,23.622053;113.757873,23.622257;113.757908,23.622357;113.757956,23.6224;113.758016,23.622422',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0},\n",
       " {'action': '',\n",
       "  'assistant_action': '到达目的地',\n",
       "  'distance': 1872,\n",
       "  'duration': 449,\n",
       "  'instruction': '沿934县道向东北骑行1872米到达目的地',\n",
       "  'orientation': '东北',\n",
       "  'polyline': '113.758016,23.622422;113.758069,23.622418;113.758116,23.62237;113.758116,23.62237;113.75816,23.622292;113.75819,23.622174;113.75816,23.621793;113.75816,23.62171;113.758177,23.621649;113.758247,23.621558;113.758316,23.621506;113.758437,23.62145;113.758772,23.621363;113.758941,23.621341;113.759054,23.621302;113.759093,23.621263;113.759115,23.621207;113.759123,23.621155;113.759097,23.621024;113.759102,23.620977;113.759132,23.620911;113.759227,23.620812;113.759353,23.620734;113.759575,23.620608;113.759696,23.620595;113.75977,23.620625;113.7598,23.620664;113.7598,23.620729;113.759735,23.62092;113.759735,23.621016;113.759735,23.621016;113.759757,23.621185;113.759961,23.621892;113.759983,23.622326;113.760022,23.622357;113.760161,23.622413;113.760321,23.622439;113.76036,23.622478;113.760365,23.622517;113.760334,23.622617;113.760278,23.622678;113.760113,23.622834;113.760022,23.622934;113.759957,23.623034;113.759861,23.623342;113.759674,23.623802;113.75967,23.623941;113.759679,23.623997;113.759718,23.624102;113.759983,23.624592;113.760109,23.62487;113.760204,23.625035;113.760352,23.625213;113.761159,23.626042;113.76122,23.626085;113.761319,23.626081;113.761372,23.626029;113.761419,23.625916;113.761428,23.625807;113.76102,23.624839;113.761003,23.624748;113.761016,23.624679;113.761046,23.624631;113.76125,23.624436;113.761337,23.624384;113.761337,23.624384;113.76174,23.624136;113.761944,23.623989;113.762296,23.623633;113.762387,23.623572;113.76273,23.623472;113.76286,23.623407;113.76296,23.623338;113.763203,23.623095;113.763203,23.623095;113.763433,23.622743;113.763503,23.622661;113.763563,23.622622;113.763633,23.622587;113.763676,23.622587;113.763707,23.622609;113.763707,23.622609;113.763724,23.622635;113.763724,23.622682;113.76365,23.622839;113.76362,23.622947;113.763559,23.623451;113.763559,23.623451;113.76349,23.623715;113.76349,23.623715;113.763446,23.623898;113.763407,23.623971;113.763359,23.624041;113.763168,23.62421;113.763095,23.624332;113.763034,23.624544;113.763038,23.624648;113.763038,23.624648;113.763051,23.624744;113.763103,23.624839;113.763273,23.6251',\n",
       "  'road': '934县道',\n",
       "  'walk_type': 0}]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results_bike = bike_path(key1_key,bike_origin,bike_destination)\n",
    "results_bike"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0                向东骑行101米右转\n",
       "1            向南骑行199米向右前方行驶\n",
       "2                向西骑行159米左转\n",
       "3                向南骑行237米左转\n",
       "4            向南骑行498米向右前方行驶\n",
       "5               向西南骑行722米左转\n",
       "6           向东南骑行412米向右前方行驶\n",
       "7           沿乌土街向南骑行1381米左转\n",
       "8            沿乌土街向东北骑行83米直行\n",
       "9      沿934县道向东北骑行2630米null\n",
       "10     沿934县道向东骑行344米向右前方行驶\n",
       "11         沿934县道向东骑行474米直行\n",
       "12         沿中田石井街向东骑行640米直行\n",
       "13         沿934县道向东骑行157米直行\n",
       "14         沿桃田岗街向东骑行2889米直行\n",
       "15      沿934县道向东骑行1222米null\n",
       "16     沿934县道向东骑行777米向右前方行驶\n",
       "17    沿934县道向东北骑行1872米到达目的地\n",
       "Name: instruction, dtype: object"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(results_bike)['instruction']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 距离测量\n",
    "- URL：https://restapi.amap.com/v3/distance?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,origin,destination（经纬度）\n",
    ">2. 选填："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "distance_origin = geocode(key1_key,\"广东省广州市中山大学南方学院\")\n",
    "distance_destination = geocode(key1_key,\"广东省广州市石门国家森林公园\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'两地的距离是：14798m'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"两地的距离是：\"+ distance(key1_key,distance_origin,distance_destination)+\"m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 行政区域查询"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 请求URL：https://restapi.amap.com/v3/config/district?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/district"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "find_adm_region = adm_region(key1_key,\"广东\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>行政区名称</th>\n",
       "      <th>区域编码</th>\n",
       "      <th>城市编码</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>汕头市</td>\n",
       "      <td>440500</td>\n",
       "      <td>0754</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>佛山市</td>\n",
       "      <td>440600</td>\n",
       "      <td>0757</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>肇庆市</td>\n",
       "      <td>441200</td>\n",
       "      <td>0758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>惠州市</td>\n",
       "      <td>441300</td>\n",
       "      <td>0752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>深圳市</td>\n",
       "      <td>440300</td>\n",
       "      <td>0755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>湛江市</td>\n",
       "      <td>440800</td>\n",
       "      <td>0759</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>珠海市</td>\n",
       "      <td>440400</td>\n",
       "      <td>0756</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>潮州市</td>\n",
       "      <td>445100</td>\n",
       "      <td>0768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>茂名市</td>\n",
       "      <td>440900</td>\n",
       "      <td>0668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>江门市</td>\n",
       "      <td>440700</td>\n",
       "      <td>0750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>河源市</td>\n",
       "      <td>441600</td>\n",
       "      <td>0762</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>云浮市</td>\n",
       "      <td>445300</td>\n",
       "      <td>0766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>汕尾市</td>\n",
       "      <td>441500</td>\n",
       "      <td>0660</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>阳江市</td>\n",
       "      <td>441700</td>\n",
       "      <td>0662</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>揭阳市</td>\n",
       "      <td>445200</td>\n",
       "      <td>0663</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>梅州市</td>\n",
       "      <td>441400</td>\n",
       "      <td>0753</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>广州市</td>\n",
       "      <td>440100</td>\n",
       "      <td>020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>韶关市</td>\n",
       "      <td>440200</td>\n",
       "      <td>0751</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>清远市</td>\n",
       "      <td>441800</td>\n",
       "      <td>0763</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>中山市</td>\n",
       "      <td>442000</td>\n",
       "      <td>0760</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>东莞市</td>\n",
       "      <td>441900</td>\n",
       "      <td>0769</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   行政区名称    区域编码  城市编码\n",
       "0    汕头市  440500  0754\n",
       "1    佛山市  440600  0757\n",
       "2    肇庆市  441200  0758\n",
       "3    惠州市  441300  0752\n",
       "4    深圳市  440300  0755\n",
       "5    湛江市  440800  0759\n",
       "6    珠海市  440400  0756\n",
       "7    潮州市  445100  0768\n",
       "8    茂名市  440900  0668\n",
       "9    江门市  440700  0750\n",
       "10   河源市  441600  0762\n",
       "11   云浮市  445300  0766\n",
       "12   汕尾市  441500  0660\n",
       "13   阳江市  441700  0662\n",
       "14   揭阳市  445200  0663\n",
       "15   梅州市  441400  0753\n",
       "16   广州市  440100   020\n",
       "17   韶关市  440200  0751\n",
       "18   清远市  441800  0763\n",
       "19   中山市  442000  0760\n",
       "20   东莞市  441900  0769"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.json_normalize(find_adm_region)[[\"name\",\"adcode\",\"citycode\"]]\n",
    "df_region = df.rename(columns = {\"name\":\"行政区名称\",\\\n",
    "                                \"adcode\":\"区域编码\",\n",
    "                                \"citycode\":\"城市编码\"\n",
    "})\n",
    "df_region"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 搜索POI\n",
    "- 提供多种查询POI信息的能力，其中包括关键字搜索、周边搜索、多边形搜索、ID查询四种筛选机制。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 关键字搜索\n",
    "- 关键字搜索：通过用POI的关键字进行条件搜索，例如：肯德基、朝阳公园等;同时支持设置POI类型搜索，例如：银行\n",
    "- 请求URL：https://restapi.amap.com/v3/place/text?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,keyword,types(keywords和types两者至少必选其一)\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/search"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>城市编码</th>\n",
       "      <th>区域编码</th>\n",
       "      <th>该城市包含此关键字的个数</th>\n",
       "      <th>城市名称</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>020</td>\n",
       "      <td>440100</td>\n",
       "      <td>1231091</td>\n",
       "      <td>广州市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0755</td>\n",
       "      <td>440300</td>\n",
       "      <td>1003578</td>\n",
       "      <td>深圳市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0769</td>\n",
       "      <td>441900</td>\n",
       "      <td>683601</td>\n",
       "      <td>东莞市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0757</td>\n",
       "      <td>440600</td>\n",
       "      <td>601183</td>\n",
       "      <td>佛山市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0760</td>\n",
       "      <td>442000</td>\n",
       "      <td>285191</td>\n",
       "      <td>中山市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>0552</td>\n",
       "      <td>340300</td>\n",
       "      <td>158</td>\n",
       "      <td>蚌埠市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>0530</td>\n",
       "      <td>371700</td>\n",
       "      <td>158</td>\n",
       "      <td>菏泽市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>0523</td>\n",
       "      <td>321200</td>\n",
       "      <td>158</td>\n",
       "      <td>泰州市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>0519</td>\n",
       "      <td>320400</td>\n",
       "      <td>158</td>\n",
       "      <td>常州市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>0416</td>\n",
       "      <td>210700</td>\n",
       "      <td>158</td>\n",
       "      <td>锦州市</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>77 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    城市编码    区域编码 该城市包含此关键字的个数 城市名称\n",
       "0    020  440100      1231091  广州市\n",
       "1   0755  440300      1003578  深圳市\n",
       "2   0769  441900       683601  东莞市\n",
       "3   0757  440600       601183  佛山市\n",
       "4   0760  442000       285191  中山市\n",
       "..   ...     ...          ...  ...\n",
       "72  0552  340300          158  蚌埠市\n",
       "73  0530  371700          158  菏泽市\n",
       "74  0523  321200          158  泰州市\n",
       "75  0519  320400          158  常州市\n",
       "76  0416  210700          158  锦州市\n",
       "\n",
       "[77 rows x 4 columns]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result_s = search_keywords(key1_key,\"广东省|大学\")\n",
    "df = pd.json_normalize(result_s['suggestion']['cities'])\n",
    "\n",
    "df_keywords = df.rename(columns = {\"citycode\":\"城市编码\",\\\n",
    "                                   \"adcode\":\"区域编码\",\n",
    "                                   \"num\":\"该城市包含此关键字的个数\",\n",
    "                                   \"name\":\"城市名称\"\n",
    "})\n",
    "df_keywords"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 周边搜索\n",
    "- 周边搜索：在用户传入经纬度坐标点附近，在设定的范围内，按照关键字或POI类型搜索；\n",
    "- 请求URL：https://restapi.amap.com/v3/place/around?parameters \n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    " > 1. 必填：key,location-中心点坐标\n",
    " > 2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/search#around"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     街电(榴芒一族中山大学南方学院店)\n",
       "1                爽爽石磨肠粉\n",
       "2                   避风塘\n",
       "3              slim tea\n",
       "4                  劲酷烤吧\n",
       "5                东记乡村美食\n",
       "6                 北方饺子馆\n",
       "7                  第1烤场\n",
       "8               叶龙老武汉烧烤\n",
       "9                 网红小串店\n",
       "10                过气轻食屋\n",
       "11                 莫凡烧烤\n",
       "12                LV柠檬茶\n",
       "13             味美轩(中大店)\n",
       "14              重庆湖边纸包鱼\n",
       "15                 我家厨房\n",
       "16       怪兽充电(中山大学南方学院)\n",
       "17                 井禾寿司\n",
       "18          Uni-hotel西餐\n",
       "19                 耀记美食\n",
       "Name: name, dtype: object"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(search_near(key1_key,distance_origin))['name']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 多边形搜索\n",
    "- 多边形搜索：在多边形区域内进行搜索\n",
    "- 请求URL：https://restapi.amap.com/v3/place/polygon?parameters \n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,polygon-经纬度坐标对\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/search#polygon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "results_search = search_polygon(key1_key,\"116.460988,40.006919|116.48231,40.007381;116.47516,39.99713|116.472596,39.985227|116.45669,39.984989|116.460988,40.006919\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'results_search' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-65-861d97e7f929>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjson_normalize\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresults_search\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'address'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'results_search' is not defined"
     ]
    }
   ],
   "source": [
    "pd.json_normalize(results_search)['address']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## IP定位"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 根据用户输入的IP地址，能够快速的帮用户定位IP的所在位置。（将IP信息转换为地理位置信息。）\n",
    "- 请求URL：https://restapi.amap.com/v3/ip?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,\n",
    ">2. 选填：ip-ip地址详见：https://lbs.amap.com/api/webservice/guide/api/search#id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'province': '北京市',\n",
       " 'city': '北京市',\n",
       " 'adcode': '110000',\n",
       " 'rectangle': '116.0119343,39.66127144;116.7829835,40.2164962'}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "loc_IP(key1_key,\"114.247.50.2\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 静态地图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 静态地图服务通过返回一张地图图片响应HTTP请求，使用户能够将高德地图以图片形式嵌入自己的网页中。用户可以指定请求的地图位置、图片大小、以及在地图上添加覆盖物，如标签、标注、折线、多边形。\n",
    "- 请求URL：https://restapi.amap.com/v3/staticmap?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,location-地图中心点（部分条件必填）,zoom-地图级别\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/staticmaps#staticmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "location = '113.679287,23.632575'\n",
    "zoom = \"8\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "def map(key,location,zoom):\n",
    "    map_url = \"https://restapi.amap.com/v3/staticmap?parameters\"\n",
    "    params = {\n",
    "        \"key\":key,\n",
    "        \"location\":location,\n",
    "        \"zoom\": zoom ,\n",
    "        \"output\":json\n",
    "}\n",
    "\n",
    "    response = requests.get(url=map_url,params=params)\n",
    "    map = response.url\n",
    "    return map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://restapi.amap.com/v3/staticmap?parameters&key=8066ec0cc0d0913d5d385f8693a88128&location=113.679287%2C23.632575&zoom=8&output=%3Cmodule+%27json%27+from+%27C%3A%5C%5CUsers%5C%5C86188%5C%5Canaconda3%5C%5Clib%5C%5Cjson%5C%5C__init__.py%27%3E'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map(key1_key,location,zoom)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 坐标转换\n",
    "- 将用户输入的非高德坐标（GPS坐标、mapbar坐标、baidu坐标）转换成高德坐标。\n",
    "- url:https://restapi.amap.com/v3/assistant/coordinate/convert?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,location-地图中心点\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/convert"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'116.4929163954,39.991183539497;116.4929163954,39.991083441841'"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transform(key1_key,'116.481499,39.990475|116.481499,39.990375')[\"locations\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 天气查询\n",
    "- 根据用户输入的adcode，查询目标区域当前/未来的天气情况\n",
    "- url:https://restapi.amap.com/v3/weather/weatherInfo?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,city-城市编码\n",
    ">2. 选填：extensions-气象类型（可选值：base/all：base-返回实况天气；all-返回预报天气）\n",
    "详见：https://lbs.amap.com/api/webservice/guide/api/weatherinfo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>日期</th>\n",
       "      <th>白天天气现象</th>\n",
       "      <th>夜晚天气现象</th>\n",
       "      <th>白天温度</th>\n",
       "      <th>夜晚温度</th>\n",
       "      <th>白天风向</th>\n",
       "      <th>夜晚风向</th>\n",
       "      <th>白天风力</th>\n",
       "      <th>夜晚风力</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-11-14</td>\n",
       "      <td>阴</td>\n",
       "      <td>阴</td>\n",
       "      <td>25</td>\n",
       "      <td>19</td>\n",
       "      <td>北</td>\n",
       "      <td>北</td>\n",
       "      <td>≤3</td>\n",
       "      <td>≤3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-11-15</td>\n",
       "      <td>阴</td>\n",
       "      <td>多云</td>\n",
       "      <td>24</td>\n",
       "      <td>19</td>\n",
       "      <td>北</td>\n",
       "      <td>北</td>\n",
       "      <td>≤3</td>\n",
       "      <td>≤3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-11-16</td>\n",
       "      <td>多云</td>\n",
       "      <td>多云</td>\n",
       "      <td>28</td>\n",
       "      <td>18</td>\n",
       "      <td>北</td>\n",
       "      <td>北</td>\n",
       "      <td>≤3</td>\n",
       "      <td>≤3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-11-17</td>\n",
       "      <td>多云</td>\n",
       "      <td>多云</td>\n",
       "      <td>28</td>\n",
       "      <td>21</td>\n",
       "      <td>北</td>\n",
       "      <td>北</td>\n",
       "      <td>≤3</td>\n",
       "      <td>≤3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           日期 白天天气现象 夜晚天气现象 白天温度 夜晚温度 白天风向 夜晚风向 白天风力 夜晚风力\n",
       "0  2020-11-14      阴      阴   25   19    北    北   ≤3   ≤3\n",
       "1  2020-11-15      阴     多云   24   19    北    北   ≤3   ≤3\n",
       "2  2020-11-16     多云     多云   28   18    北    北   ≤3   ≤3\n",
       "3  2020-11-17     多云     多云   28   21    北    北   ≤3   ≤3"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weather_s = weather(key1_key,\"440117\")\n",
    "df = pd.json_normalize(weather_s['forecasts'][0]['casts'])[[\"date\",\"dayweather\",\"nightweather\",\"daytemp\",\"nighttemp\",\"daywind\",\"nightwind\",\"daypower\",\"nightpower\"]]\n",
    "\n",
    "df_weather = df.rename(columns={\"date\":\"日期\",\\\n",
    "                              \"dayweather\":\"白天天气现象\",\n",
    "                              \"nightweather\":\"夜晚天气现象\",\n",
    "                              \"daytemp\":\"白天温度\",\n",
    "                              \"nighttemp\":\"夜晚温度\",\n",
    "                              \"daywind\":\"白天风向\",\n",
    "                              \"nightwind\":\"夜晚风向\",\n",
    "                              \"daypower\":\"白天风力\",\n",
    "                              \"nightpower\":\"夜晚风力\"\n",
    "    \n",
    "})\n",
    "df_weather"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输入提示\n",
    "- 根据用户输入的关键词查询返回建议列表。\n",
    "- url:\thttps://restapi.amap.com/v3/assistant/inputtips?parameters\n",
    "- 请求方式-GET\n",
    "- 参数：\n",
    ">1. 必填：key,keywords-查询关键词\n",
    ">2. 选填：详见：https://lbs.amap.com/api/webservice/guide/api/inputtips"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>建议提示列表名称</th>\n",
       "      <th>所属区域</th>\n",
       "      <th>区域编码</th>\n",
       "      <th>地址</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>从化区</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>从化汽车站</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>从城大道28号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>从化大桥</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>从化客运站(地铁站)</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>14号线</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>从化服务区</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>从化戴姆勒</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>太平镇从化经济开发区创业路53号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>从化血站</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>河滨南路33号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>石门国家森林公园</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>温泉镇</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>从化大道</td>\n",
       "      <td>广东省广州市从化区</td>\n",
       "      <td>440117</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>从化庄</td>\n",
       "      <td>广东省广州市花都区</td>\n",
       "      <td>440114</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     建议提示列表名称       所属区域    区域编码                地址\n",
       "0         从化区  广东省广州市从化区  440117                []\n",
       "1       从化汽车站  广东省广州市从化区  440117           从城大道28号\n",
       "2        从化大桥  广东省广州市从化区  440117                []\n",
       "3  从化客运站(地铁站)  广东省广州市从化区  440117              14号线\n",
       "4       从化服务区  广东省广州市从化区  440117                []\n",
       "5       从化戴姆勒  广东省广州市从化区  440117  太平镇从化经济开发区创业路53号\n",
       "6        从化血站  广东省广州市从化区  440117           河滨南路33号\n",
       "7    石门国家森林公园  广东省广州市从化区  440117               温泉镇\n",
       "8        从化大道  广东省广州市从化区  440117                []\n",
       "9         从化庄  广东省广州市花都区  440114                []"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "search_note = note(key1_key,\"从化\")\n",
    "df = pd.json_normalize(search_note[\"tips\"])[[\"name\",\"district\",\"adcode\",\"address\"]]\n",
    "df_note = df.rename(columns={\"name\":\"建议提示列表名称\",\\\n",
    "                             \"district\":\"所属区域\",\n",
    "                             \"adcode\":\"区域编码\",\n",
    "                             \"address\":\"地址\"\n",
    "})\n",
    "df_note"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
